Greetings!
I was trying to develop a small A.I. for an enemy. The idea is having an invisible sprite playing as sensor, so when the player is overlapping it for more than 2 seconds, the enemy related to that sensor changes it's animation and tries to smash your character.
I was wondering how do I set a timer just for that character, so it can run with this logic:
-Set object timer to 0.
-When player is overlapping sensor, the object timer starts.
-If time = 2 (sec.) then "attack" attribute activates, and after completing the attack, it will return to 0 and set the animation to a non-attacking behaviour.
-If player is not overlapping sensor, set object timer to 0.
-Else, keep the regular animation.
Something like that. The idea is that, in a platformer, you can run through that enemy without getting damage, except if you stay near it for 2 seconds. You know, like a small trap that waits a little bit.
Maybe it can be done by the "wait" option, but I don't know how to set it up exactly.
Maybe there's another way to program time-controlled reactions for the characters, but I don't know. Do you think it can be done?
Thank you for any help you can give me.