spawn actor and score

Hey guys,

I am creating a game app with spawn actors and a score. I would like when i pressed an actor (associated with a number) score up to this number, and when i click again on this same actor score cancel the sum.

the problem is when i click on a actor the score doesn't stop to increase. I just put game.score+ actor number. Moreover, i don't know how if i touch again the actor to cancel the addition.

So if someone can help me!!!!

Here the link for dropbox file: https://www.dropbox.com/s/v68kqlikqo71msx/test 22 à supprimer du vendredi soir.rar

Comments

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

    Create a boolean attribute in each actor called self.clicked. The initial value should be false (unchecked). If touch is pressed then... if self.clicked is false add to the score and change self.clicked to true; else (if self.clicked is true) subtract from the score and change self.clicked to false.

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

  • Many thanks for your answer, works perfectly

Sign In or Register to comment.