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

Support multiple named animations per Tile #986

Open
Rialgar opened this issue Jun 16, 2015 · 9 comments
Open

Support multiple named animations per Tile #986

Rialgar opened this issue Jun 16, 2015 · 9 comments
Labels
feature It's a feature, not a bug.

Comments

@Rialgar
Copy link

Rialgar commented Jun 16, 2015

I would really like to have multiple (named) animations on one tile, this is especially useful for objects, since these might change their animation during the game.
Some examples:

  • Collectibles that make a little splosh when collected
  • Enemies that can walk, stand, die, ...
  • A Goal that shows a nice animation when reached
    It would be great to have all these animation specifications in a single place, and I think the Tiled file would be an excellent location.

For the time being I will probably create each animation on the starting tile and add the names as custom properties.

@bjorn bjorn added the feature It's a feature, not a bug. label Jun 16, 2015
@IMMZ
Copy link
Contributor

IMMZ commented Aug 6, 2015

I have no idea why the animations is linked to the tiles. I think it would be useful just save animations under the 'map' node, linking them to the map. The only thing to be change is tile ids - they should have absolute values (like on the layers), not relative to the tileset. It will allow to make animations from different tilesets and to have multiply animations on the map - easy and useful. Each animation should have 'id' and 'name' property then the users could find them on the map and set them to their objects in their code.

Idea looks like

<map version="1.0" orientation="orthogonal" renderorder="right-down" width="50" height="50" tilewidth="32" tileheight="32" nextobjectid="12">
  <animation id="0" name="character_walk">
    <frame tileid="120" duration="100"/>
    <frame tileid="121" duration="100"/>
    <frame tileid="122" duration="100"/>
    <frame tileid="123" duration="100"/>
    <frame tileid="124" duration="100"/>
    <frame tileid="125" duration="100"/>
  </animation>
  <animation id="1" name="character_jump">
    <frame tileid="15" duration="100"/>
    <frame tileid="16" duration="100"/>
    <frame tileid="17" duration="100"/>
    <frame tileid="18" duration="100"/>
    <frame tileid="19" duration="100"/>
  </animation>
...

@bjorn
Copy link
Member

bjorn commented Aug 6, 2015

The reason animations are defined in the tileset is because the expectation is that you will define the animation once, then save it along with an (external) tileset, and use this tileset in many maps. If the animation was saved in the map, then the only way to use it in another map is to copy it over. And then it also gets really annoying when you want to change that animation, because of having multiple copies.

Defining animations using frames from multiple tilesets seemed like a very rare use-case in comparison, so I decided not to support that.

@bjorn
Copy link
Member

bjorn commented Sep 12, 2018

Just adding a note that this request was also mentioned on the forum.

@Phlosioneer
Copy link
Contributor

There is a bounty on this issue, so it should probably have a bounty tag.

@bjorn
Copy link
Member

bjorn commented Dec 17, 2019

@Phlosioneer Thanks for checking the bounties. I've opted to simply delete that tag since there really isn't much happening with BountySource to make it worth it. Any bounties still active on BountySource remain valid though.

@joereynolds
Copy link

I'm also keen to see this in but I have a feeling it's quite low priority.
Is this sort of thing possible to do via a javascript extension or is the extension not able to write to .tsx files?

I quite like the XML changes that @IMMZ suggested (though not on the map) and I'd be happy to write an extension if possible.

@eishiya
Copy link
Contributor

eishiya commented Oct 13, 2023

Is this sort of thing possible to do via a javascript extension or is the extension not able to write to .tsx files?

Scripts can write TSX files, but specification-compliant TSX files can't store multiple lists of animations and existing TSX loaders probably won't load them, and Tiled can't preview multiple animations per tile.

Something you can already do is put all the animations on the tile as a single long animation, and use custom properties to tell your engine which frames belong to which animation. Scripting could even be used to preview these in Tiled, by temporarily removing the frames for other animations.

@bjorn
Copy link
Member

bjorn commented Oct 16, 2023

@joereynolds Did you consider adding this feature to Tiled directly, rather than going through the scripting API? It would be preferable for this kind of feature, and I can provide some guidance when necessary.

@joereynolds
Copy link

I've never touched C++ but I'm open to giving it a try if I find the time.
Thanks for the help (if I end up needing it) :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature It's a feature, not a bug.
Projects
None yet
Development

No branches or pull requests

6 participants