Is it possible to use a variable for "Set animation"?

0 favourites
  • 4 posts
From the Asset Store
3 pixel charaters with over 8 animations each + animations with a gun
  • I have a sprite that has 10 animations (labeled 1-10) and I want the game to pick the animation based on an Instance variable so if the variable is set to 5 the animation it will play is the one labeled 5.

    Is this possible or do I need to create 10 "If instance variable = X then set animation to X" events?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Yes it is possible to play animation based on variable value. Make sure to use str to call the animation.

    For example:

    + System: Trigger once

    -> Sprite: Set animation to str(Self.num) (play from beginning)

  • Yes it is possible to play animation based on variable value. Make sure to use str to call the animation.

    For example:

    + System: Trigger once

    -> Sprite: Set animation to str(Self.num) (play from beginning)

    Thank you, I was missing the str() portion. :)

  • str(char1.HP). Just FYI in Construct 2 user can't rename animation to just a number while in C3 it is permissible. So in C2 the name with number must followed by alphabet for instance 1a, 2Big, etc.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)