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

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?

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
-
jonmulcahy Posts: 10,408
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