I'm setting up a special function that, when a player collides with an enemy, will replace the player with a "hurt" sprite (which won't collide with enemies), wait for a few seconds, and then switch back to the player sprite. Is there any way to implement this waiting period in special functions or script? (I mean, I guess I could just put a for loop or a counting function that executes every frame in the script, but there's got to be a more elegant solution than that.
[edit]: I've been poking around in the code reference, and I came across the OnFrameStart event. I've got the framerate capped, so I guess I could increment a variable every frame, and when the player gets hit I could store the current frame number. Once the difference between the current and stored frame number reaches X, I could switch back. But that's (relatively) slow and inelegant. (Plus, having a variable that constantly increases forever would probably crash the game if it were left on long enough, so that's probably not a good idea). Am I missing something that's right in my face, or should I go ahead and start coding what I've described?
Thanks in advance.