Hooray for keystates!

Shows how much of a noob I am really, but I just discovered that SDL lets you check keystates at any time, not just when a keypress event is raised. This makes the movement code much, much simpler. Currently attempting to let you jump, which currently conflicts horribly with the code that stops you falling through the floor… Wait a minute! I think I’ve cracked it! I just need to do a check if the vertical velocity is negative! Yay! 😀

Tags: SDL

Comments

30. Aug 2009 · 14:02 UTC
If you just check for negative velocity you’ll be able to keep jumping as long as you’re moving upwards XD