Make a button only usable once.

christochristo Member Posts: 14
edited November -1 in Working with GS (Mac)
I have a rule on a button to change attribute "game.score" to "game.score+random(50,100)" which is great for what i need. However, I only want the player to be able to use it once – then they are unable to use it to keep increasing their score.

I don't want to destroy the button because I want to keep it in the scene. I just want to make it so that if it is pushed a second time it wont add to the score again.

Thanks!

Comments

  • PhoticsPhotics Member Posts: 4,172
    You can add a toggle inside the button...

    self.ready

    Check that attribute.

    If touch is pressed and self.ready is true
    Change game.score to game.score+bonus
    Change self.ready to false.
  • christochristo Member Posts: 14
    I probably did not do it right because the score will not show up now.
  • PhoticsPhotics Member Posts: 4,172
    christo said:
    I probably did not do it right because the score will not show up now.

    The order might be important... change the score before disabling the toggle.
    Also, the actor's attribute has to be set to true by default.
  • christochristo Member Posts: 14
    How do you set the actor attribute to true by default -- Thank you for your help!!
  • ShineyGamesShineyGames Member Posts: 157
    You could just put a blank actor over the button art actor (with no rules)and put the rules in the blank one then destroy that one. The art button will stay but not do anything
Sign In or Register to comment.