How to destroy an actor after certain amount of taps?

iKleptiKlept Member Posts: 3
edited November 2013 in Working with GS (Mac)
I'm making a game where you tap the objects on the screen a certain amount of taps before they get destroyed.

My question is, is it possible to do that. Destroy an actor after let's say 3 touches/taps (for mobile).

Any help is appreciated.

Comments

  • SocksSocks London, UK.Member Posts: 12,822
    Make an attribute.

    Place a rule in the actor that says every time the actor is tapped increase this attribute by +1

    Place another rule in the actor that says when this attribute =3 then destroy the actor.
  • jamie_cjamie_c ImagineLabs.rocks Member, PRO Posts: 5,772
    Make an Integer Attribute called Taps, then on the actor do a rule when touch is pressed add 1 to Taps. Do another rule that says when Taps = 3, destory the actor.
  • zweg25zweg25 Member Posts: 738
    Yes this is very possible. Go to your actor and make an attribute in him called taps (do this by going into the actor and then hitting th plus sign under the actors attributes- i.e. position, size, color, etc).
    Then make a rule in that actor saying if attribute self.taps >= 3 (or however many number of taps you like) destroy actor.
    Make another rule that says if actor receives event touch is press change attribute self.taps to self.taps + 1.
    Hope this helps
  • iKleptiKlept Member Posts: 3
    Thank you both for your help. :D
Sign In or Register to comment.