Snake (2nd part): Smooth-Moving

Hey there! :persecutioncomplex:

I’m still workin’ on my Snake’s game (latest version)! ;D I think out that I want to jump to Slick library and, by the way, I have new game’s loop as well! :point:

My next goal is to make the snake to move in constant time from A to B (let’s say that length from A to B is 20 pixels), but player needs to see the snake actually moving pixel by pixel. It’s like smooth-moving! SPEED is contant of snake’s speed. I need to somehow implement it all… old snake, Slick and/or new loop. Any ideas? Examples, links to tutorials, anything? I know that we can figure it out! 8)

If i remember correctly, your position updates UNIT distance every time frame. If you kept two variables, one for the unit it should move to and another for individual pixels. The speed equation (general) = UNIT / time so to move at that speed but one pixel at a time it would look like:
1/x = UNIT/time
x = time/unit
There for you should move render the snake 1 pixel every update time witch would be: (time / unit distance).

Please correct any errors I may have created here, I like to learn from those mistakes.

Familiar looking code :slight_smile: