How to stop previous Timeline when switching unit states?

Not favoritedFavorited Favorited 0 favourites
  • 1 posts
From the Asset Store
State Machine
$10.99 USD
State Machine is a great tool for managing the state of anything in your game.
  • I’m working on a simplified RTS. I animate unit states (idle, move, attack) using Timeline, and as long as animation/property names match across sprites, everything works fine.

    The problem: when switching states, the previous timeline doesn’t stop — it keeps playing on top of the new one. So an idle squash & stretch + a walk angle change end up stacking together.

    Stopping the animation or unsetting instances before playing a new timeline doesn’t seem to work.

    Has anyone run into this? Is there a proper way to stop or clear the previous timeline before playing the next one?

    + UnitsA: State = "chase"

    + Sprites_Units: Pick instance with UID UnitsA.SpriteUID

    -----> TimelineController: Set Sprites_Units to track "" of the next timeline

    -----> TimelineController: Play Anim_Walk with tags str(Sprites_Units.UID)

    + UnitsA: State = "idle"

    + Sprites_Units: Pick instance with UID UnitsA.SpriteUID

    -----> TimelineController: Set Sprites_Units to track "" of the next timeline

    -----> TimelineController: Play Anim_Idle with tags str(Sprites_Units.UID)

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
Jump to:
Active Users
There are 0 visitors browsing this topic (0 users and 0 guests)