Ideas on making a platform that moves along a track?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By kowid51384

I want to make a platform that will follow a modular track that I will build out of tiles in the editor, but I’m not sure where to begin. 2D platformer games tend to have platforms like this (Super Mario, for instance). I like the idea of tracks because it visually tells a player exactly where a platform is going, which removes a lot of potential frustration and trial-and-error, but I also feel that it would be a lot easier on myself to build tracks rather than set waypoints for each platform.

:bust_in_silhouette: Reply From: gnumaru

The usual way of implementing moving platforms on tracks is using Path2D and PathFollow2D:

This has not related at all with tiles, though. You could paint your platform track tiles just as a visual thing, totally unrelated to game logic, and manually create a Curve2D on your Path2D that matches the layout of the track tiles.

Or you could create a tool script that procedurally creates a tilemap node under the Path2D node filling the correct coordinates with the correct tiles to match the curve. Or you could do the other way around, a tool script that takes the tile coordinates of the tiles of a tile map and create a Path2D out of it.

I will try to create a tool script that takes the tile coordinates of the tiles of a tile map and create a Path2D out of it, thank you.

kowid51384 | 2021-10-27 16:21