Short time invincibility question...
Hey all, quick question. My actor has three energy bars. The desired effect is to have him blink on and off for one or two seconds when he gets hit. During this time I want him to be momentarily invincible (similar to many other games). Let me show you what i've done and maybe you can tell me what i'm doing wrong- because while it works sometimes- other times he just keeps blinking forever and therefor invincible forever.
- when hit change attribute (integer) "hit or not" to 2 (meaning he's hit)
- when "hit or not" is 2, set timer within actor to FOR 1 second do...
- animate (i have a blink animation set).
- i also have a rule that says that an enemy can only hurt the actor IF the "hit or not" is set to 1.
- i have another timer inside the actor that says AFTER 1 second change attribute "hit or not" to 1 (thus returning him back to normal).
So what am i doing wrong? It works most of the time but other times he gets hit and blinks forever. Obviously its the coding not changing his attribute back to 1. Curious if this may have something to do with the timer and its check box (i forgot the exact wording. Its something like override or follow through to completion, etc.)
Thanks a million!
- when hit change attribute (integer) "hit or not" to 2 (meaning he's hit)
- when "hit or not" is 2, set timer within actor to FOR 1 second do...
- animate (i have a blink animation set).
- i also have a rule that says that an enemy can only hurt the actor IF the "hit or not" is set to 1.
- i have another timer inside the actor that says AFTER 1 second change attribute "hit or not" to 1 (thus returning him back to normal).
So what am i doing wrong? It works most of the time but other times he gets hit and blinks forever. Obviously its the coding not changing his attribute back to 1. Curious if this may have something to do with the timer and its check box (i forgot the exact wording. Its something like override or follow through to completion, etc.)
Thanks a million!
Comments
Also, have you considered using interpolate to change the actors alpha to 0 and back to 1 again to create a blinking effect?