mapeditor / tiled

Flexible level editor
https://www.mapeditor.org/
Other
11.21k stars 1.76k forks source link

Animated Tiles #57

Closed stefanbeller closed 10 years ago

stefanbeller commented 13 years ago

Tiles should easily be animated. Either by using an animated gif or other animated format. The other option would be to cycle through some tiles within one tileset.

bjorn commented 10 years ago

@Bertram25 Actually the reason the tileset view is duplicated is not primarily to simplify things, but rather because of conflicting behavior when both "selecting the tile to animate" and "selecting the frames to put in the animation" would happen in the same view.

The "Preview" text is indeed a placeholder where I would put an actual preview on the animation. For recognizing tiles that are animated, I am considering to make it look like a piece of film. And, of course there will be an option to turn off animations in the main view, but it's not implemented yet.

bjorn commented 10 years ago

Due to Qt only drawing the drop indicator in list mode and not in icon mode, I've rearranged the layout as follows:

screenshot - 01122014 - 10 24 57 pm

Maybe this looks better anyway. Unfortunately, I wasn't able to finish it this weekend since I basically had only today to work on it. However, I made some good progress:

What's left to do is:

Bertram25 commented 10 years ago

@bjorn Hi again, I took a few sec to try it but I couldn't find how you open it. Can you hint me? (using master branch of tiled here.)

bjorn commented 10 years ago

@Bertram25 Sorry, while the animation support itself was pushed to master this new dialog is still work in progress and I will only push it to master once it is actually working. But, I will try to remember to update the wip/animation branch this evening so you can try it out.

Bertram25 commented 10 years ago

@bjorn Np, take the time needed. I was just asking as I saw a few commits about it in master. ;) I'd rather not interrupt your momentum now and try it out when you consider this feature "in RC".

bjorn commented 10 years ago

I didn't have much time this weekend so I only fixed a crash, fixed compile with Qt 5.2 and then fixed compile again with Qt 5.2 / VS 2012 on Windows. Fortunately most of the big things are done (checked them away above) and the only remaining parts are displaying animated tiles differently, a tile animation preview and the JSON format (and Lua too, actually). Should be able to round that off over the coming days.

bjorn commented 10 years ago

Animated tiles are now marked in the tileset view:

screenshot - 01202014 - 10 39 00 pm

MichaelAquilina commented 10 years ago

Things are moving along it seems. I look forward to using this long awaited feature!

On Mon, Jan 20, 2014 at 9:40 PM, Thorbjørn Lindeijer < notifications@github.com> wrote:

Animated tiles are now marked in the tileset view:

[image: screenshot - 01202014 - 10 39 00 pm]https://f.cloud.github.com/assets/531764/1958536/5a5edaee-821b-11e3-9fb8-cdc848e28f37.png

— Reply to this email directly or view it on GitHubhttps://github.com/bjorn/tiled/issues/57#issuecomment-32799695 .

Michael Aquilina

Bertram25 commented 10 years ago

Hi @bjorn :D Great to see such improvements becoming real. I have two suggestions: First of all, I wondered whether you woul consider making the animated marker less intrusive, something like this: movie_proposal (The animated tag is less present, and I also set its opacity to 60%).

If you want to keep it that way, you might need to know there is a pixel offset on the bottom of the tile: pix_offset

Best regards,

bjorn commented 10 years ago

@Bertram25 I can't believe I missed that pixel offset! Anyway I really like your suggestion so I'll change this overlay accordingly once I have the other missing parts done.

bjorn commented 10 years ago

I've pushed the work so far to the master branch and updated the Windows and Mac OS X daily builds. Other daily builds should update automatically soon. The only thing still missing is the preview in the tile animation editor, and of course there can always be further improvements like the one suggested by @Bertram25 above.

I'll be gone over the next 4 days, but meanwhile feedback is welcome!

bjorn commented 10 years ago

Is there nobody with feedback? Did anybody try it out?

Bertram25 commented 10 years ago

@bjorn Hi :) I did. But I'll do it more thoroughly by the end of the week. Anybody else has tried it?

Bertram25 commented 10 years ago

@bjorn Well, I tried it. Loading/sabing tmw files with animated data is just here and done. :) Now, can you tell from a new map how I add an animation linked to a tile? I was unable to find that.

Best regards,

bjorn commented 10 years ago

@Bertram25 Right, sorry I should have written a little manual. Here comes the tiny manual:

If you have placed the tile you're editing the animation of on the map, you should see the animation playing there automatically and it will update as you change it.

Bertram25 commented 10 years ago

@bjorn My bad, I should have seen it. It was rather obvious after all. :)

Tried it, and it's working great so far. (I didn't try exporting animated tiles data in something other than the tmx format yet.)

If you wanted feedback basically, here is some:

Best regards,

Clean3d commented 10 years ago

@Bertram25 If you're using Linux, depending on your desktop environment you might be able to right-click the window and select "always on top".

@bjorn Everything seems to work well for me so far! I know I'm testing this pretty late, so I hope my input is useful somehow anyway.

The animated tiles get out of sync for me while I'm editing. I suppose this is inevitable if you have animations whose durations never align, but it might be nice to have some sort of "reset timing" option. I guess an example of where this might be useful would be if you have a terrain that's an animated shoreline, and the various tide frames need to sync up.

Bertram25 commented 10 years ago

@Bertram25 If you're using Linux, depending on your desktop environment you might be able to right-click the window and select "always on top".

Already did. :) Yet, I am sure there is an OS independant solution to this.

englercj commented 10 years ago

Excited for this feature! Notice it was added to the 0.10 milestone, is there any ETA for v0.10.0?

bjorn commented 10 years ago

@englercj The milestone is just for organizing the release, and there's some smaller things still to do on this feature before the release hence I added it there. However, this feature is already available on the master branch (and the daily builds), so please try it out!

I can't give ETA on things that rely on my spare time. My last goal was to get 0.10 out in August, but it's currently looking like I'm not going to make it.

bjorn commented 10 years ago

Alright, animation preview pushed in 48fdd68f2dd59cbfdabac2e91cc17f051d620911. With that I'd like to close this task rather than keeping it open until it's perfect.

@Bertram25 I know I didn't get around to the "animated tile" marker change you suggested, but I hope you don't mind I'll keep that as a possible future enhancement and focus instead on getting 0.10 out.

@Clean3d Thanks for your feedback and indeed the thing with animations getting out of sync bothers me as well. I'll have to think of some solution for this later as well.

Bertram25 commented 10 years ago

@Bertram25 I know I didn't get around to the "animated tile" marker change you suggested, but I hope you don't mind I'll keep that as a possible future enhancement and focus instead on getting 0.10 out.

Np. This isn't important.

sudhalucky commented 10 years ago

Hi @bjorn ,

I am very happy to see this feature rolled out in the last update. I just wanted to know if the respective code to play the animation is available for Cocos 2d-x framework. We are currently working on a tile map game which has lot of tile animations and I jumped out of joy when I saw the tile animation working perfectly. May I please know the part of code to add in Cocos 2d-x v3.2 to make the tiles animate in my game.

Thanks a lot. Sudhaker

bjorn commented 10 years ago

@sudhalucky Sorry but I don't have time to help you with that. This is something you have to talk to the cocos2d-x developers about. The feature is very new so it is understandable that cocos2d-x does not support it yet, and since it's not based on custom properties but adds new XML tags to the TMX format, support for this will have to be coded explicitly.

sudhalucky commented 10 years ago

@bjorn Thank you for your instant reply. I have raised a feature request on Cocos2d-x forum and they did consider this for development. For now I am writing my own code to parse the XML tags and play the animation.

However I observed one issue in the tool, once a tile is added to the animation list there is no way to remove the tile in the UI but to delete it from the XML by manually editing, I hope you are already working on this.

Sudhaker

bjorn commented 10 years ago

@sudhalucky Hmm, you should be able to select frames in the list and press the Delete key to remove them. Is this not working for you? If not, on which platform?

alphaonex86 commented 9 years ago

Hello,

See my animation format: http://catchchallenger.first-world.info/wiki/Map_format in some case I need random offset to prevent all tile start at same animation level. I plan update my format to your format into the next major version (into 2-5y). Maybe can you think about animation + trigger, trigger declanched into menu on tile?

Cheers,

bjorn commented 9 years ago

@alphaonex86 Well, trigger could already be done by a custom property, but at the moment you can define only a single animation per tile. So if you want separate animations for opening and closing, in Tiled you may define this as one animation and then use custom properties to indicate when to play back which part of the animation.

alphaonex86 commented 9 years ago

1) Having random starting frame is useful to do lava animation. It's same animation but start at different frame to have random place bubble. 2) My target is more have into tiled a generic way to visualize/edit multiple animation sequence on one tile. My idea it have multiple animation sequence, one without trigger (the default), other with trigger label, with repeat option. Why? Because like lot of game, I have implemented that's in my game via custom property, but a common way (but generic) to do that's and good support into the editor, will help the mapper to visualize better the map, and fire it self the trigger to visualizer it. Example: My door have one tile animation (then no animation), 2 trigger: open, close, each linked with opening/closing animation. After my application will fire it when it want. But if the editor will have menu to fire it too, it will be great. Maybe another issue?

Rialgar commented 9 years ago

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:

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 commented 9 years ago

@Rialgar Yes, it's a feature that could be added. Maybe you could open a separate issue about it?

hoangbv15 commented 7 years ago

Hello, apologies on commenting on a very old and closed issue, but I am genuinely wondering if there's a more efficient way of defining tile animations, other than selecting a tile, choosing "tile animation editor" menu option, drag and drop tiles, repeat.

My tile set has above 100 tiles, with each tile has its own animation. It does become a bit tedious going through the GUI to do the animation for all tiles.

The frames are put vertically on top of each other in a sprite sheet, so potentially could I manually edit the .tmx file with a text editor to add the animation myself? Or is there a better way to do it?