Jump to content

  • Log In with Google      Sign In   
  • Create Account

Moving a player while holding down a key.


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
21 replies to this topic

#21 BeerNutts   Crossbones+   -  Reputation: 2942

Like
0Likes
Like

Posted 03 January 2013 - 03:49 PM

I tried that method. It was the first thing I tried
If I hold down the key the payer doesn't move. I have to repeatedly tap the key.

 

Yeah, but you have to call handleKeys() on EVERY LOOP, not just when an SDL Key Event is triggered.

 

If you are checking the key state every single loop, then you will always see the key is down, and it WILL always move.


My Gamedev Journal: 2D Game Making, the Easy Way

---(Old Blog, still has good info): 2dGameMaking
-----
"No one ever posts on that message board; it's too crowded." - Yoga Berra (sorta)

Sponsor:

#22 GDsnakes   Members   -  Reputation: 145

Like
0Likes
Like

Posted 03 January 2013 - 05:41 PM

I tried that method. It was the first thing I tried
If I hold down the key the payer doesn't move. I have to repeatedly tap the key.

 

 

Yeah, but you have to call handleKeys() on EVERY LOOP, not just when an SDL Key Event is triggered.

 

If you are checking the key state every single loop, then you will always see the key is down, and it WILL always move.

ahhh thank you very much. I just figured it out lol. You were right.

 

 

 

I love the Gamedev community! you guys are a big help.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS