Log In  
Follow
Gannett

Old duffer who grew up with 8-bit computers in the 80s and still can't write code!

[ :: Read More :: ]

I'm creating a small game where a player is on a grid of tiles. I want the player to move smoothly from one tile to the next, not appear instantly in the next tile. I tried to create a delay loop in the update function when the direction key was pressed, but the sprite still appears instantly 8 pixels to the left, right, etc.

The sprite is drawn, then when I hit, say, right, then the loop increments the x position, but it doesn't draw the sprite again until the loop is completed. How would I go about moving the sprite 1 pixel per frame for 8 pixels then stop?

I can sort of imagine what I need to do, but it's just a sort of jumble in my mind right now!

P#116612 2022-08-30 21:04