Animated Tiles?

Ah… got it:

!!! {name: closed start: 1 count: 1 time: 1000 loopCount: 1}, {name: opened frames:{2,3,4,5,6}  time: 500 loopCount: 0 }

Thx! :slight_smile:


Tile animations will definitely stay in sync. However, without code, you can’t override a tile’s starting frame. (Actually, I don’t even think Dusk lets you with code…)

  • Caleb

What about the culling? How can I start tile animations off screen? Should I turn off culling for the sprite tiles? If so, how is this done for each tile?

UPDATE: I found this here:

map.layer[1].\_lockTileDrawn(x, y) -- A core method that locks a single tile at an x,y tile position

but it doesn’t seem to work!?

Is there a way to stop tiles culling of some tiles off screen, so the sprite animation of this tiles can be started while they (the tiles) are out of the screen borders?

I want to achieve this: I have some water animation tiles and I want them to start playing in the map at start of the scene. But the sprite:play() is only starting the tiles on screen. How can I do this?

Sounds like I have the exact same setup as you with several equal tiles next to each other playing in sync. All I do is add properties in tiled(My spritesheet has 13 frames):

anim:enabled true anim:options !!! start: 1 count: 13 time: 1000

Then the animation starts when the tiles are drawn and no need to do anything in code.

You don’t need tile:play() at all. Dusk handles tile animations on its own. If you set up an animation in properties, Dusk will animate it when it comes on-screen and keep it synced with all other tiles of the same type. Is there some specific reason you need more control over it?

  • Caleb

Thank you all for the detailed info!

Regarding “in sync” I need tiles that allow the following for example: I have a sequence of a water surface for a water animation. This is build in TILED with water tiles side by side. BUT the animation should be like this:

Tile1, Tile2, Tile3

This are three water tiles set side by side in TILED. Each of the tiles is showing the same water animation BUT starts with a different frame as first frame of the animation, so there is an illusion of waves on the surface which seem to be bigger than the standard tile size.

I wonder if the water surface is still “playing” correctly if for example Tile3 was culled and redrawn when the screen is entered again, while Tile1 and Tile2 are staying on the screen during the culling of Tile3.

Hope this makes sense somehow… but please note I haven’t tested the info here you gave me, so maybe everything is already working! :slight_smile:

Thx again!

Dusk does not currently sync all animations to the same time. Instead, it syncs them to the first built tile. This means that each animated tile will stay in sync with each other tile of the same type, but they will not stay in sync with other non-related animated tiles. Dusk 1.0 syncs all animations to the map build time, though, so this will be fixed in 1.0. (And sorry for continually saying that, but the Dusk repo on my end is in extensive reconstruction mode, so I can’t really release small fixes that easily. I’m doing my very best to get Dusk 1.0 all together.)

  • Caleb