StarArawn / bevy_tiled

A plugin for rendering tiled maps.
MIT License
151 stars 40 forks source link

Load object groups / objects, and add auto-reload support #36

Closed dmtaub closed 3 years ago

dmtaub commented 3 years ago

This adds basic support for rectangular objects (including tile sprite objectes!) in Orthographic mode. We also add auto-reload support via asset events.

Note: this branch includes my other PR changes (tile rotation fix and dependent assets) as well as @framp's bevy 0.4.0 changes if you want me to squash commits together to make it more mergeable, please LMK

Objects without tile maps also may be made visible by way of passing the debug configuration object to the TiledMapComponents bundle:

debug_config: DebugConfig {
    enabled: true,
    ..Default::default()
},

When an object is created, it fires an ObjectReadyEvent event which includes the map asset handle and the entity ID for the newly-created object. This allows additional custom behavior in consuming application (e.g. collision).

I haven't done any testing/implementation of isometric, as I haven't been working with isometric maps in my project :)

There isn't yet any support for round or polygon objects, but I wanted to do that next. Because it's hard to visualize and I like the bevy_tiled having the responsibility for spawning entities, I was going to add lyon as a dependency to allow debug visualizations of circle/polygon cases. However, I recognize how it might not make sense to open PRs after adding a new dependency, so I wanted to issue this PR first...

OTOH, if you like this direction, I will write up some documentation. and maybe find time to look at isometric objects.

dmtaub commented 3 years ago

This has been squashed into one commit on the bevy-0.4-objects branch and will soon be on main