Secretchronicles / TSC

An open source two-dimensional platform game.
https://secretchronicles.org/
GNU General Public License v3.0
205 stars 49 forks source link

Allow World Map Animations... #483

Open datahead8888 opened 9 years ago

datahead8888 commented 9 years ago

As discussed at http://forum.secretchronicles.de/topics/305 it would be great to be able to have animations for sprites in the world map.

To quote Quintus:

There has never been a possibility to animate things on the world map. It’s a nice idea, but I guess this will be implemented as part of a more genaralised handling of animated tiles in TSC. Currently, each animated object requires some C++ code for it, whereas it’d be nicer to just have some loading code in a central class that reads in animation config files. Especially as we have the latter (.imgset files) already thanks to @simpletoon.

So long story short: Currently we can’t have animations on the world map.
brianvanderburg2 commented 9 years ago

I may take a look at this and see what can be done whenever I get some free time. For now just some ideas and thoughts.

This seems like it should allow a sprite added to the overworld that would be animated as follows:

<sprite>
   <!-- position/passive -->
   <property name="image" value="world/objects/hedge/green.imgset" />
</sprite>

green.imgset:

time 100
green_1.png
green_2.png
green_3.png
green_2.png

Just from a quick skim of the code in devel, it seems like this should work, including plain sequential animations but also some randomness in frame branching. Eventually I should add a file describing the .anim format.

brianvanderburg2 commented 9 years ago

I just tested this by editing world 1's world.xml and setting some sprite to use an enemy .imgset file "enemy/larry/grey/walk.imgset". It seems to work correctly.

datahead8888 commented 9 years ago

Could you post it in a PR so that we can try it out? Be sure to include testing instructions or worlds/levels as needed.

brianvanderburg2 commented 9 years ago

Pull request here: #484

There isn't any changes to code needed, it just requires manually editing the world XML files. Currently neither the level editor or world editor that I'm aware of have a way to show imgset items in the editor. I don't know anything about the editor code so don't know how to change that.

Quintus commented 8 years ago

Very cool. Now we only need a to add a UI element in the editor that supports animated graphics...

Vale, Quintus