Jump to content

  • Log In with Google      Sign In   
  • Create Account

#Actualkidman171

Posted 31 January 2013 - 10:41 PM

What you should do is keep track of when the key gets pressed and when it gets released. You could have a simple array of bools, one for each key. When you get an SDL_Keydown event, switch the key in your bool array to true. When you get an SDL_Keyup event, switch the key in your bool array to false. Then in your update loop, you can just check your bool array to see if x is pressed and move your sprite accordingly.


#1kidman171

Posted 31 January 2013 - 10:40 PM

What you should do is keep track of when the key gets pressed and when it gets released. You could have a simple array of bools, one for each key. When you get an SDL_Keydown event, switch the key in your bool array on. When you get an SDL_Keyup event, switch the key in your bool array to false.


PARTNERS