Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for Tiled animated tiles #190

Merged
merged 1 commit into from May 2, 2016

Conversation

CJRii
Copy link
Contributor

@CJRii CJRii commented May 1, 2016

This will allow the running of animations from Tile Layers. The SpriteBatch extension methods have been modified to now accept an optional parameter of a GameTime instance. If one is not provided, the animations will only show the first tile of the animation. The core of the change is that now all TiledTile objects will potentially have a reference to a TiledTileSetTile which contains all the information about the animation. This also has the side-effect of being able to access the Additional Properties of the tileset tiles.
Things that will need to be updated in the future:

  • When the support to display Object Layers is implemented, animations will have to implemented there as well
  • When layers are refactored to be more memory friendly as discussed in issue [Tiled] Rendering large maps uses a lot of memory #136 the animation code will more than likely need updating as well.

The TiledMaps Demo has been updated to utilize the new functionality.

@craftworkgames
Copy link
Collaborator

I did a quick code review and it looks good.

Did you update the demo to include animated tiles?

I'll take a closer look later.

@CJRii
Copy link
Contributor Author

CJRii commented May 2, 2016

I did update the TiledMaps demo application. I should also note, this is a breaking change in that the Tiled assets from older apps will have to run through the pipeline tool again to insert the new fields the reader is expecting.

@lithiumtoast
Copy link
Contributor

lithiumtoast commented May 2, 2016

@CJRii I think this line

_uniqueTileSetTiles = _animatedTiles.Select(t => t.TileSetTile).Distinct().ToList();

is going to cause extra garbage to be generated since it's called every time map is drawn (60 times per second for 60 FPS).

@CJRii
Copy link
Contributor Author

CJRii commented May 2, 2016

@lithiumtoast That line is inside the if block starting at line 67:

if (_renderTarget == null)

so it is going to only run once per layer because _renderTarget will be set in that same block.

@lithiumtoast
Copy link
Contributor

@CJRii Ah you are right. Should looked at the whole file not just the diff.

@craftworkgames craftworkgames merged commit a18061b into craftworkgames:develop May 2, 2016
@craftworkgames
Copy link
Collaborator

Wonderful work mate. Merged 😄

@zoalasaurusrawr
Copy link
Contributor

zoalasaurusrawr commented Jan 14, 2017

Is there any way to get this change as part of a nuget package? Sorry for the necro but I'm in a position where I can't build from source atm.

Sorry for the necro.

EDIT: Found the pre-release nuget feed, sorry for raising an old thread. Solved!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants