Playing part of an animation xml file

Use TPlayAnimationParameters.StopNotification feature to implement “playing a list of animations, in a sequence”.

This mechanism was already mentioned, with examples, in 2 threads where you participated :slight_smile:

  1. Sprite control with the new system - #2 by michalis ,

  2. Play all animations in sequence - #8 by michalis .

The latter thread contains a ready example from me that you can adjust to do exactly what you need here. It implements RunAllAnimations , taking AnimList := Scene.AnimationsList. You can adjust it to implement instead

RunAnimationList(const Scene: TCastleSceneCore; const AnimNames: array of Strings)

You would then call it like

RunAnimationList(Scene, ['kyleyturnfronttosw’,‘kyleyturnswtoleft’, ‘kyleyturnlefttonw’, ‘kyleyturnnwtoback'])

The only difference between your RunAnimationList and the RunAllAnimations is how to populate the AnimList, list of animations scheduled to play. In RunAnimationList you should

  • make sure to clear AnimList and stop current animation, if any
  • populate the AnimList with new animation names you want to play (``AnimNames` from my declaration)

You can already do this. You can refer to the same PNG image from multiple sprite sheets, in any format (Starling XML or .castle-sprite-sheets), this was never a problem. You can just edit the XML files in a text editor to make them refer to the same PNG.

The “Support for multile atlas files for one sprite sheet” ticket you mention is about a different thing – to have one .castle-sprite-sheet refer to multiple PNG files.

Because the main features are working and we are just using them, see e.g. recent news about Platformer by Castle Game Engine release – it’s a CGE demo that is using new sprite sheets for everything.