How can I make an actor die or disappear after five taps?
I'm trying to make it look like i'm fighting an actor and he'll die after five clicks or touch press on it, any suggestions? I have a rough idea on how to do it but just assuming someone has a much better and faster way of implementing something like this.
Best Answers
-
supafly129 Posts: 454
Create an integer attribute within the actor called "Tap" or whatever you want to name it
Create a rule "When touch pressed" --> Change self.Attribute Tap to self.Attribute Tap +1
Create a rule "When self. Attribute Tap = 5" --> Destroy Actor
Screenshot
http://www.tiikoni.com/tis/view/?id=558337a -
Dues Posts: 1,159
When touch is pressed
Change Attribute: game.tap to (game.tap + 1)%6
that makes it go to 5 and when you tap it again it resets to 0 and starts over.
Just remember that when you destroy an actor, it actually gets destoyed. I would recommend to move its position off screen instead of destroying it.
-
supafly129 Posts: 454
@dellagarpo said:
If you don't want the actor to destroy and you are moving it out of range, you could say:
"When self. attribute Tap = 5
Change self. attribute Tap to 0"
Answers
AWESOMEEEEEE! Thanks Very Much!
Follow up question, how can I reset it to start counting again once it's done getting that 5 taps?
that's what exactly my question is for cause I wasn't destroying the actor but moving it out of range rather, thanks again, as always you're awesome
very very very much appreciated
@supafly129 @Dues Last question in regards to this matter, lol...... How can I make it reset to zero if I didn't make the set amount of taps within a time frame. Ex: I need to tap 5 times within 10 seconds, if I don't make it, it'll reset to zero and start over again.
I figured it out, I put a timer that in after 10 seconds: if game.attribute is < 5, then reset to 0