notnullgames / tiled-kaboom

Load maps made in Tiled into Kaboom!
https://notnullgames.github.io/tiled-kaboom/
20 stars 3 forks source link

animated tiles + some other features #1

Closed blurymind closed 3 years ago

blurymind commented 3 years ago

The demo page indicates that animated tiles aren't supported.

Are they a planned feature?

Other features I wonder if supported:

konsumer commented 3 years ago

I have my current plans in the todo. With most of these, this lib is just a translator from TIled's map format to kaboom, and then you are free to use that directly in kaboom code, as you normally would do that thing.

I happily accept PRs, if you want to work on any of this. Make a discussion issue first, so we can talk about it, and make sure it's something we agree on a need for, then go for it! The overall goal for me is to stay simple, not get too in the way of kaboom & tiled's awesomeness, so I chose to not wrap them too much, just provide the tools to load a tiled map and do what you want with it, in kaboom. I'm open to a more complete ready-made solution to "load a tiled map into kaboom" but first I'm more interested in supporting the basic features of each (like external tilesets, physics-editor and animations would be sick.)

I wonder if some of these could be separate kaboom plugins. Like maybe you load the tiled-map part with this, and hand the map-object (with all the tiles loaded) to a separate physics plugin. This lib does a pretty good job of turning a tiled-map into something that is readable (unbase64/uncompress/turn into kaboom text-map/etc) so maybe it could be up to other kaboom plugins to implement the other stuff.

konsumer commented 3 years ago

Since kaboom itself doesn't seem to directly have support for animations directly in tilemap, it might be another thing that loadTiledMap returns. like if you have info about what layer it's on, and the sprite-frames it uses, you could add them in after the addLevel yourself. I could see returning a collection of object-shapes that defines the areas that you can loop over with area/solid, but I don't see anything for complex shapes (like a squigly coastline) it all seems per-rectangle. with that in mind, maybe just a property for all tiles that are solid, like solid=true would make sense, but it's basically up to however you want to do that. One thing that might be useful is to return the "post-parsed" copy of the map, that is after it's been decompressed/turned into an array of tile-ids, etc. Armed with that, it would be enough to work out other things in your own kaboom code, without having to duplicate all that stuff, but still keep it very "it's just regular kaboom code". I think what I like about kaboom the most is it's not all ready-made, but you can compose what you want with pretty simple little bits of code, and I want to keep with that style.

konsumer commented 3 years ago

I added returning the decompressed/parsed map-object (mapObj.)

It's published in tiled-kaboom@0.0.11 (on npm) and should show up everywhere else, soon.

So for now, you could make your own tile-properties parsing pretty simply, by looping over an object layer, or whtaver else, and pull out the properties.

I also added some demo code for looking up object-properties. You can see it's very easy to use, even without any helpers or whatever.

Screenshot from 2021-08-11 16-15-48

Screenshot from 2021-08-11 16-16-48

konsumer commented 3 years ago

I made a bunch of issues to track the TODOs, so I will close this. Feel free to comment on the individual issues.