Hello Guest

Author Topic: Sharing Animations between different sprites and quick Tilemap Q  (Read 3464 times)

stacktrace

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 10
    • View Profile
Sharing Animations between different sprites and quick Tilemap Q
« on: December 03, 2013, 09:04:17 pm »
Just two quick questions about the toolkit.

Is it possible to change out the frames used in an animation?  (I am working on a strategy game, which has a Red and Blue team with the same units and graphics except for the color, and I would like to only have to define an animation once and apply it to the matching unit on each team)

Is the Tilemap an Editor only construct, or is it useful (and possible) to use in code?  (wondering if it gains any of the same benefits as your static sprite batcher, or if under the scenes you are gluing the vertex of each tile together to prevent any seams from showing).

And if the answer to the above is no, can you apply a static sprite batcher to a set of sprites created at runtime (from a loaded map) rather than in the editor?


Thanks for your time.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Sharing Animations between different sprites and quick Tilemap Q
« Reply #1 on: December 03, 2013, 11:13:55 pm »
To swap the frames I suggest writing a little animation editor extension to do it. Docs for the plugin system here: http://www.2dtoolkit.com/docs/latest/advanced/animation_editor_operators.html

The tile map will work fine in this case. You can change the necessary data easily.

You can also create static sprite batchers at runtime.
http://www.2dtoolkit.com/docs/latest/advanced/scripting_static_sprite_batcher.html

Both options work fine - if your scene is a bit more tiled, and bigger - the tile map will be better as it automatically partitions it into smaller chunks for better performance.

stacktrace

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: Sharing Animations between different sprites and quick Tilemap Q
« Reply #2 on: December 03, 2013, 11:29:08 pm »
Thanks for the quick reply, you just got yourself a sell.

stacktrace

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: Sharing Animations between different sprites and quick Tilemap Q
« Reply #3 on: December 04, 2013, 04:03:11 am »
Very happy with my choice to purchase 2D Toolkit, I had the tilemap setup and working with tile data loaded in code in a snap.