Movement with Inertia

This cart shows how to move a player with smooth movement, and inertia to slow the player down.

Notes: The basic idea is that instead of moving the player by specific pixel amounts, you just add to the player's speed when you press the movement buttons. Then, if the movement buttons are not being pressed, the player's speed will decrease until they come to a stop.

This cart also has a more complex function for collision detection. Instead of just immediately stopping the player from moving if they try to move into a wall, the function will find out how far they can move and move them there instead.

Download

Download
movement_with_interia.p8.png 10 kB

Install instructions

Save this file to your PICO-8 carts folder. Then load it by typing load movement_with_inertia in the command line mode of PICO-8.