Jump to content

View more

Image of the Day

「筋肉兄貴のスーパーラン!」
夕焼けにガラス・・・(´・ω・`)
ガラスは割りたいでしょうけど、割ったらクリアできないですよ。
(o・ω・o)
 #indiedev  #indiegame #screenshotsaturday https://t.co/fhKO5NJ5ee
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net's newsletters to receive the latest updates and exclusive content.


Sign up now

Moving a player while holding down a key.

2: Adsense

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   Members   

4348
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)

#22 GDsnakes   Members   

151
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.