Playing part of an animation xml file

Yes! This is what I was looking for but I could not get it working because I could not figure out how to calculate the backward playing distance.
Thanks!

Now I have this and it works perfectly :slight_smile:

procedure TStateMain.SetAnimationRange;
var A, B, AnimCountForward, AnimCountBackward: Integer;
List: array[0..20] of string;
begin
  AnimList := Scene1.AnimationsList;
  For A := 0 to AnimList.Count-1 do
  begin
    List[A] := AnimList[A];
    if List[A] = FirstAnimationName then FirstAnim := A;  // find current animationame and remember its index
  end;

  For B := 0 to AnimList.Count-1 do
  begin
    List[B] := AnimList[B];
    if List[B] = LastAnimationName then LastAnim := B;  // find destination animation and remember its index
  end;

  AnimCountForward := LastAnim - FirstAnim;  // count the forward number of animations between them
  If AnimCountForward < 0 then AnimCountForward := (AnimCountForward + AnimList.Count);

  AnimCountBackward := AnimList.Count - AnimCountForward; // count the backward number of animations between them
  if AnimCountBackward < AnimCountForward then PlayForward := False else PlayForward := True;

Yes, I should have named it like RunAnimationRange.

Ok, maybe I will try this for the above, but since it works at last now I dont’ dare to change again :slight_smile:
I think I will use RunAnimationList for playing certain animations in the sprite sheet and ā€˜RunAnimationRange’ only for turning the sprite.