How do I change animation based on tap?

0 favourites
  • 5 posts
From the Asset Store
Full game Construct 2 and Construct 3 to post on Google Play
  • once the player changes an animation it does not change back. I want to make it so on tap sets animation to "1" and when I tap a second time it should set animation to "0" and vice versa

  • once the player changes an animation it does not change back. I want to make it so on tap sets animation to "1" and when I tap a second time it should set animation to "0" and vice versa

    Check it

    http://www.filedropper.com/animationchange

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • have a variable on the sprite, so on click the variable is added or subtracted.

    then have animation play on variable = 0, or 1

    add a wait function after. otherwise it can be prone to doing both actions on click

    on touch, sprite ___________ set variable =1

    sprite.variable = 0 _________ wait 0.2 seconds

    on touch, sprite ____________ set variable =0

    sprite.variable = 1 __________wait 0.2 seconds

    this should allow multiple instances of clicks too!

  • have a variable on the sprite, so on click the variable is added or subtracted.

    then have animation play on variable = 0, or 1

    add a wait function after. otherwise it can be prone to doing both actions on click

    on touch, sprite ___________ set variable =1

    sprite.variable = 0 _________ wait 0.2 seconds

    on touch, sprite ____________ set variable =0

    sprite.variable = 1 __________wait 0.2 seconds

    this should allow multiple instances of clicks too!

    It would be even easier to use a boolean variable and toggle it on tap..

    Or if you want to use a number

    on touch sprite - set variable1 = 1-variable1

    which would result in a toggle..

  • I forgot to add

    sprite.variable=0 ________ play animation

    sprite.variable=1________play animation1

    also, could just do

    on click/touch sprite__________________play animation1

    animation default is playing

    on click/touch sprite__________________play default

    animation animation1 is playing

    LittleStain: you are right, however if you wanted more than 2 animations to cycle through. a Boolean wouldn't cut it

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