0 votes

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.
Placing tracks within Mario Maker

Godot version Godot v3.3.4
in Engine by (43 points)

1 Answer

+1 vote
Best answer

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

https://docs.godotengine.org/en/stable/classes/class_path2d.html

https://docs.godotengine.org/en/stable/classes/class_pathfollow2d.html

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.

by (265 points)
selected by

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.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.