How do I change frame by variable?

0 favourites
  • 5 posts
From the Asset Store
Selection frame like in RTS games, works both on mobile and desktop devices.
  • Hi!

    I need to make a mute button. I thought it should be simple. I have a Sprite and when I click on it, the variable changes from 0 to 1 and the frame changes from 0 to 1 based on the value of the variable. When you click on it again Sprite must change its frame and Variable but it does not work. The first click is triggered, the variable and the frame changes, but nothing happens on the second click.

    I need some help :)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Instead of "sound=0" condition in event #3 use "Else"

  • Instead of "sound=0" condition in event #3 use "Else"

    Thanks!

    But where is the logic?

    What if I need to check if variable=2 or =3,=4...

    Why does this simple expression not work?

    I click the Sprite and if the Variable =1, then what is specified for this event should work.

    If the variable = 2, then another, =3 is still another.

    Is this a program bug?

  • Events are executed from top to bottom. So currently, in event #2 you set sound to 0, that's why the next event #3 is also triggered.

    If you want to compare several values, you should add "Else" to each condition:

    If Sound=0 .....
    
    Else 
    If sound=1 .....
    
    Else 
    If sound=2 .....
    
  • Events are executed from top to bottom. So currently, in event #2 you set sound to 0, that's why the next event #3 is also triggered.

    If you want to compare several values, you should add "Else" to each condition:

    > If Sound=0 .....
    
    Else 
    If sound=1 .....
    
    Else 
    If sound=2 .....
    

    you explained it very cool and clear! Thanks! now I understand the logic :)))

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