Your code looks ok. I'm not too framiliar with the key repeating. It is
something SDL provides, but I don't think many people use it. For my
projects I usually just track when the arrow keys are pressed and
released. Then every frame I can check which keys are being held down
and move appropriately.
Check out the "aliens" example that comes with Pygame. It shows exactly
what you want.
yanom @linuxmail.org wrote:
I have a problem with my pygame project:
i used pygame.key.set_repeat(2,2) to make it so that continually holding down
the left or right arrow keys moves a character. i have a problem though:
whenever i press a key other than left or right, even if i am still holding an
arrow key, my character stops moving. here is my code:
...
how do i solve this problem?