I’m making a runner game, and I want to use a tilemap for my background.
I need to spawn tiles at the top of the screen and delete them when they are no longer visible.
My Tilemap is constantly moving downward
The problem is that I don’t have constant top and bottom screen coordinates when using a tilemap. Maybe a tilemap isn’t the best option in my case? Thanks!
I wouldn’t bother with the Tilemap unless there is some specific service you need from it… just spawn the sprites and slide them down and destroy them at the bottom.
If you MUST have a Tilemap your choices might be:
have one tilemap and slide it down by only one tile, then snap it back up while reading/writing all the tiles one line down, overwriting the bottom line of tiles.
have two tilemaps and slide them down, recycling and refreshing them, swapping them as you go
The first option (partial slide and then rewrite) is an almost 100% match to how early character generator graphics were done: C64, Vic-20, Atari and later such as NES and SNES and all the way until even now probably as far as hardware support for it.