Hi all,
I am experimenting with SDL, and I made a very small game (it actually can't be called a game :) ). It simply checks for key input, and if the arrow keys are pressed, the x and y of the sprite are changed accordingly. Then the sprite is blitted. My problem is: when I press for example the up key once, the sprite moves 5 pixels up, which is correct. But when I hold the up key (or any other arrow key), the sprite stays where it is and doesn't move. Here is the part of the code I think the error is in:
I first had all those arrow-press checking ifs in a switch, and I tried to solve the problem like this, but the problem still wasn't solved. I also changed the bottom 4 ifs to else ifs, but still the problem. Any help?