Adding +1 to Score Only Once

I'm working on a game where you tap a particular object to score a point. After its tapped I want it to continue across the screen. Right now I have it set to...when pressed game.score+1. That however allows the player to continuously tap the object to increase the score.
How do make it so tapping each object only increases the score by 1?
Thanks!
How do make it so tapping each object only increases the score by 1?
Thanks!
Comments
then have a rule in the object when attribute tap=0 and touch is pressed
-change score to score+1
-change attribute tap to 1
Here's what I did...
1. Rule...when pressed change score to score+1
2. A Rule under that ...when tap=0 change tap to 1
In that same actor, create a rule that says this;
When self.score = 0
AND
touch is pressed
Change attribute self.score to 1
Change attribute game.score to game.score + 1
That will only allow the player to add +1 to the score ONLY one time.
(Only need one rule. You don't need a rule imbedded in the first rule).
One thing I forgot to mention. I'm having the same 4 objects repeatedly spawn on one side and scroll to the other. So having this set up now I tap the one object and the score increases by 1 but when I tap on the next spawn of the object nothing happens because of the constraint I've put on it.
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
Bool is faster then int
Thanks!
Appreciate the help!
I didn't know that it's faster than using integers - that's an added bonus!
Can you confirm you are using self attributes?
Now I have a wall set up at the end that if the actor touches it it subtracts a life. How do I make the wall only subtract a life if the actor hasn't been tapped? In other words whether or not the actor has been tapped a life is subtracted when it hits the wall.
When ... actor receives event ... overlaps or collides ... with ... actor of type ... wall
If you don't refer to the self.score attribute, then it won't matter if the actor has been tapped or not.