Making Script For TileMap

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

Hey, i creating a platformer 2D game that i use TileMap for level design but some of tiles that i have must have special scripts like when user collide with them they must be destroyed or append something to a variable is this possible to do with TileMap? if it’s not possible, anyone have suggestion? i know i can create another scene and customize it fully then use that hundred times but i don’t think its easy to design and good in performance

EDIT: i find a addon => Tile Spawner - Godot Asset Library

:bust_in_silhouette: Reply From: Hariom

Step:1downlod a 3d gound image from google
Step:2create a tile map node
Step:3set tile map
Step:4use downloaded image as tile

:bust_in_silhouette: Reply From: Inces

Tilemap is still good way to do this, but it will require much more code. You will have to menage big Dictionary with all of your tiles as keys, and their variant metadata as values.
There will also have to be some code to detect on which tile are your actors - getting global position every frame, translating it to world_to_map and using setget to notificate when new tile has been approached. This will give you a lot of freedom and elasticity on whatever You want each tile to do.

Thanks for your time but i don’t think that what i was searching for
i found a addon that may be useful: Tile Spawner - Godot Asset Library

CarCedo | 2021-12-06 10:29

Ok , but You realize this addon utilizes real scenes, not tiles ?

It is great approach for platformer like this, but when You want to do some kind of tile-based puzzle, tactical rpg or city-builder, You would be better using Tilemap instead of hundreds of objects

Inces | 2021-12-06 11:49

Yes i know that it’s just convert tile map to the scene objects but it makes the work much easier =)

CarCedo | 2021-12-07 20:49