PICO-8: Smooth Map Screens
Smooth Map Screens
This cart demonstrates how to have different map screens that follows the player around the map, with smooth transitions as the camera moves from map screen to map screen. This cart adds onto the Map Screens cart. It is heavily commented so you can pull apart how this is being achieved.
Notes: The basic idea is that instead of just setting the camera position exactly to match the current map screen, the camera position is moved smoothly to match the current map scree. It does this by percentages, instead of by exact, set amounts of movement. This means that when the camera is far away, it will move quickly, but as the camera gets closer to the current map screen, it slows down smoothly until it comes to a stop. This creates a very clean, smooth transition from screen to screen. The speed that this occurs can be easily set with a single variable.
As with the Map Screens cart, this code is based off the Map-Based Grid Movement cart, but this will also work with pixel-based movement without any real code changes. However, the comments in this cart only pertain to the smooth camera transitions.
Save this file to your PICO-8 carts folder. Then load it by typing
load map_screens_smooth in the command line mode of PICO-8.