SFML community forums

Help => System => Topic started by: ruben98 on June 09, 2013, 08:52:06 pm

Title: If keyboard isn't pressed
Post by: ruben98 on June 09, 2013, 08:52:06 pm
Hello,

I wanne make a game, and when there isn't a key pressed I wanne let the character face forward.
How do I do that.

Thanks  :)
Title: Re: If keyboard isn't pressed
Post by: The Hatchet on June 09, 2013, 08:58:40 pm
You could make 'forward' the default facing direction, then whenever a Key is released set direction to forward.  Just one idea.
Title: Re: If keyboard isn't pressed
Post by: ruben98 on June 09, 2013, 09:25:44 pm
Hmmm that's smart but how do I do that?
Title: Re: If keyboard isn't pressed
Post by: The Hatchet on June 10, 2013, 07:47:08 am
There's a KeyReleased event I believe, and how you iterate your Direction is up to you.  I just use an int 0-3 to show what way i'm going.
Title: Re: If keyboard isn't pressed
Post by: Nexus on June 10, 2013, 11:11:56 am
I wanne make a game, and when there isn't a key pressed I wanne let the character face forward.
How do I do that.
Have you already read the SFML tutorials? Because it seems like you haven't worked with SFML at all. If you read them, it should become obvious how to solve this problem ;)