Button clickable once

gurrafgurraf Member Posts: 5

Hi, I'm kind of new to gamesalad and starting off by creating a quiz game, everything works fine but I now have a problem...
Since it is score based I only want the player to be able to click the correct answer button once, since it generates a score. As it is now the buttons rule is that it changes color and ads to the score, but you can click it many times. I want to have a separate button for next answer, otherwise I guess I could have changed rule to click= next slide... Thank you all in advance!

Comments

  • SocksSocks London, UK.Member Posts: 12,822
    edited May 2014

    Welcome !!

    As it is now the buttons rule is that it changes color and ads to the score, but you can click it many times

    In the button make a boolen attribute (an attribute that only has two states, on/off) let's call it ClickCheck.

    It defaults to 0, leave it on 0.

    In your touch rule for your button - I am going to presume it is 'when touch is pressed' - add another condition that says 'When 'ClickCheck' = 0'.

    So now the conditions that must be met for the button to work are it needs to be touched and ClickCheck needs to be 0.

    In the rules place a change attribute, set it to change ClickCheck to 1.

    Job done !

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

    This is exactly what boolean attributes are for. Create a game attribute and name it something like game.answered. When the question has been answered, change game.answered to true. On each possible answer actor, add the rule condition When game.answered is false...

    Then when you are ready for the next question, change game.answered back to false.

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

  • gurrafgurraf Member Posts: 5

    Thank you both so much! Really appreciate it!

Sign In or Register to comment.