How to change something to false and the true again?

Okay basically I have to buttons. Button Left and Button Right (they are both touch buttons). I want someone to touch Button Right and immediately Button Right doesn't work anymore until you touch Button Left and that activates Button Right again but makes Button Left inoperable until you touch Button Right. Then the cycle begins all over again! I know it involes Booleans I think button when I tried it the buttons weren't working as I planned.

Hope you guys understand lol! thanks!

Victor :)

Comments

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited July 2014

    Use the mod function in each button's rules to toggle the value of an integer game attribute. Activate each button depending on the value of the attribute:

    Right button
    If Touch is Pressed AND attribute game.whichButton = 0 [behaviors for the right button] Change attribute game.whichButton to mod(game.whichButton+1,2)

    Left button
    If Touch is Pressed AND attribute game.whichButton = 1 [behaviors for the left button] Change attribute game.whichButton to mod(game.whichButton+1,2)

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • http_gamesaladhttp_gamesalad Member Posts: 1,340

    @tatiang it worked perfect!

Sign In or Register to comment.