Defold Tilemap Animator

#1

Hello! This is my first contribution to the Defold workspace and my first post to the forums.

I’ve been developing ideas on and off for a few weeks. One of the issues I ran into was the fact that Defold doesn’t support runtime tile animations. Most of the games that I love to play now and loved to play growing up boasted beautiful tilemap scenes with moving parts all over the place, so I couldn’t resist attempting to add this feature into my own ideas.

Defold Tilemap Animator (DTA) is a very simple Lua module that allows you to animate your tilemaps with just a single function call–and some additional animation group information, but that part is pretty fun so I don’t count it as a burden!

It can be improved substantially with new features, however it is in a workable state and able to be used with confidence in any Defold project. I will continue to update it in the future, so please let me hear your ideas if you’re interested.

This project should be on the Asset Portal soon, if it gets approved.

12 Likes

#2

Sounds like a good module, thanks! Yet the link in github to the html5 example is not working.
http://planksoftware.com/html/defold_tilemap_automator.html

2 Likes

#3

Approved! It should show up in the Asset Portal in a couple of minutes.

1 Like

#4

Yes, I will fix this issue once I draft a more interesting example project and implement a couple new features.

0 Likes

#5

Thank you! I will submit cover art for the asset soon.

1 Like

#6

Full version 1.0 has been released. It now supports four loop playbacks:

  1. “loop_forward”
  2. “loop_backward”
  3. “loop_pingpong”
  4. “loop_corolla”

And four on-demand playbacks:

  1. “once_forward”
  2. “once_backward”
  3. “once_pingpong”
  4. “once_corolla”

On-demand playbacks are the bread and butter of DTA: they allow you to programmatically run animations on any tile assigned with a “once_” playback. This can be used to display interactive visual effects on a tilemap, such as the player stepping through grass or chopping down a tree. I’m pleased to see these playbacks working properly!

4 Likes

#7

This asset is amazing! :wink:

Just a small note, that for me natural was that “once_forward” should end at “end_tile”

function dta.once_forward(data, instance_data)
    instance_data["frame"] = instance_data["frame"] + 1
    if instance_data["frame"] > data["end_tile"] then
    	instance_data["frame"] = data["end_tile"] -- not "start_tile"
    	instance_data["extra"] = 9999
    end
end
2 Likes

#8

Thanks! Glad you like it. I see what you mean about the start_tile preference, I will look into it. I actually plan to rewrite this module soon, since there are quite a few components I can make more flexible and efficient. Now that I’ve learned about semantic versioning and how to handle open source projects properly, hopefully there won’t be too many setup changes after I get the new version out. :slight_smile:

If you have any feature ideas, let me know! I’ve started using this in my own project and I realize there may be some additional functions I could add to make things super convenient.

2 Likes

#9

Yoau can see DTA here in action on the grass: :smiley: :leaves:

One feature I was thinking on was using DTA to set tiles properly according to some event (e.g. when that grass is burnt), but I came out with a workaround of just modifying “animation_group” table to suite my needs :wink:

3 Likes

#10

Looks great! Bringing tile map worlds to life is exactly what I was hoping to see more of.

As for the suggestion, that’s in part why I added once_animations and the dta.animate(x, y) function. If you keep track of where the fire is burning, you can pass the coordinates to that function to roll the new animation.

Oh wait. Actually, something just came to kind. You mean you’re trying to assign both a continuous grass animation and a burning animation when an event occurs? I didn’t think of that. :persevere:

Yes, you could edit the tables, but I’d like to make a safer way of dealing with that. Thanks for the suggestion, I’ll make sure to work it in soon.

1 Like

#11

No, no. One solution will be to draw burnt version of tileset and use it with your DTA - I will just set_tile to another tile (let’s say 100) and in “animation_group” there will be an entry starting at 100 and with end_tile = e.g. 110, so one normal animation, but I’m changing a tile :wink:

But that’s a lot of drawing and I’m thinking about some shader instead, but for now I have something pretty easy and pretty ugly:

(it’s working just like 2D lights, but color is black and not drawn on background (but drawn on hero sprite - that you can see it in the end of this gif)

I don’t like it now, but perhaps I’m going into a proper direction with something like a “decay” on the ground. For grass I will probably need to make something different.

1 Like