Actor not destroying when tapped..?

justinodunnjustinodunn Member, PRO Posts: 226
So i made an actor when tapped 4 times, it will destroy itself. the code works like this.

when actor overlaps/ collides with invisible actor, change attribute self.touch to self.touch+1.

when self.touch= 4, after 0.7 seconds, change attribute self. touch to 0, destroy..

and no matter how many times i tap the actor, it doesnt destroy?

Comments

  • ArmellineArmelline Member, PRO Posts: 5,415
    The rules you've explained there doesn't include any actual rule to monitor for taps, only overlaps with the invisible actor.

    Are you destroying it based on the number of times you tap it, or the number of times it collides/overlaps?
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    Also, make sure your rule is When attribute self.touch ≥ 4

    Otherwise, you may find that self.touch is greater than 4 and your existing rule isn't firing.
  • CrazyApeCrazyApe Member Posts: 64

    Create a new integer attribute called Taps and set it to 0.
    Then create a rule in the actor.
    When actor receives event touch is pressed, Change attribute game.taps to game.taps+1.

    Then create another rules.
    When attribute game.taps=4
    After 0.7 seconds Destroy.

    http://tinypic.com/view.php?pic=2m4odxh&s=8#.UxxiVvRdV4U

  • CrazyApeCrazyApe Member Posts: 64

    Sorry the other picture was wrong this one is correct
    http://tinypic.com/view.php?pic=5463rs&s=8#.UxxirvRdV4U

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited March 2014

    Hi, your Rules look OK; so to my mind, the reason it's not working is one of two things:

    • Either you've not put game.Taps (the one on the right hand side of the Change Attribute behaviour) via the drop downs in the Expression Editor, (in other words, it's just been typed in) or

    • Your attribute game.Taps isn't an integer, real or index.

Sign In or Register to comment.