straker / kontra

A lightweight JavaScript gaming micro-library, optimized for js13kGames.
https://straker.github.io/kontra/
MIT License
955 stars 99 forks source link

Is it possible to use an animated sprite on a tile within the tileengine? #345

Open GrimLothar opened 1 year ago

GrimLothar commented 1 year ago

I noticed that Tiled editor does have the option to create animated tiles, but when I create one and use it within the tileengine, it is not animating it

straker commented 1 year ago

I didn't know Titled had an option for animated tiles. That's pretty cool. Currently Kontra does not support that, but I can look into it.

GrimLothar commented 1 year ago

That would be awesome!! Looks like when you create an animated tile, it exports it in the json like this (inside the tilesets object):

 "tilesets":[
        {
         "columns":8,
         "firstgid":1,
         "image":"tilesheet.png",
         "imageheight":256,
         "imagewidth":256,
         "margin":0,
         "name":"tilesheet",
         "spacing":0,
         "tilecount":64,
         "tileheight":32,
         "tiles":[
                {
                 "animation":[
                        {
                         "duration":300,
                         "tileid":9
                        }, 
                        {
                         "duration":300,
                         "tileid":17
                        }],
                 "id":33
                }],
         "tilewidth":32
        }],