How to animate tilemaps (SOLVED)

I saw this person who has a git that is suppose to animate tilemaps but I have no idea on how to use it at all

Can someone explain what I can do to make tilemaps animate

You can set the tiles manually to be different on a looping timer.delay for animated tiles.

The shader one uses an offset in the position to set the alternate frame.

This is where the offset is used

This is where it’s set

It relies tiles to be at certain positions.

Just changing the tile image with a timer.delay to move between frames would be easier.

1 Like

yes it was this git i have no idea how to use

what do i put in the go.property"frames"
and i put the url of the tilemap in go.property"tilemap"
also what else do i have to change for the script informations

In this example, frames would be the number of animation frames your tilemap has in its cells.

I’ll make a working example in a few minutes.

2 Likes

Here’s a working example for the UV. You will need to make sure you set the material properly as well as the proper url. This method doesn’t work well if you extrude your tiles which means you will want to use nearest neighbor sampling.

animated tilemap uv.zip (4.2 KB)

You can also of course use timer.delay() to go through tiles based on their frames… there would be many ways to do this. You could probably make a similar script or at least helper module to loop through all of the tiles and find the tiles which need to be animated over time. Then you loop through that once and update only those tiles per delay.

6 Likes

Omg thank u

i fiddled around with ur project, so the delay sets the fps but when i change the frames nothing happens

Frames depends on the number of tiles on the horizontal row of the tileset. In this example there are only 2 frames.

@Johan Do you remember how you used this method? I assume you put animated tiles on their own tilemap and then static on another below it with each their own tilesets?

@illuminae You should still explore using timer.delay to swap tiles. Try and figure out how you can search a tilemap to find tiles you should animate, and then figure out how to animate them over time based on number of frames they should have. I might make a module to help with this in the future… but anyone else could too!

1 Like

okay thank u very much -(uwu)-

Yes, the animated tiles was on a separate tilemap than static tiles. The reason for not using timer.delay is simple: that api wasn’t around when I wrote this.

4 Likes