How Do I Hold an Object for a Specific Amount of Time?

uhyanauhyana Member Posts: 36
edited April 2012 in Working with GS (Mac)
I have an actor spawning exponentially and a user can touch it by swiping it in any direction or touching and holding down. I used the same method found in this video.



The actor moves exactly how I want it to except I only want a user to be able to hold this actor for lets say, 3 seconds. Ideally I want if the user touches and holds it for more than 3 seconds the actor will be destroyed, however if the user holds it for anything less than 3 seconds it will not be destroyed and the user can continue to hold it for something < 3 seconds, release, then hold it again for something < 3 seconds and so on. Basically, how can I make this actor touchable for any amount of time less than 3 seconds and destroy for any amount of time greater than 3 seconds?

Best Answer

  • jonmulcahyjonmulcahy Posts: 10,408
    Accepted Answer
    Have a rule that when the actor is touched it increases a custom attribute by .5 every .5 seconds (or whatever timeframe you want)

    When attribute = 3
    Destroy actor

    When actor is not touched
    attribute = 0

Answers

  • uhyanauhyana Member Posts: 36
    edited April 2012
    Thank you! I created a new rule when actor is touched, every 1 second, change game.TouchTime to game.TouchTime+1. I got it from here, thanks for the help!
Sign In or Register to comment.