How to give invincibility for 5 seconds after colliding with an actor?

In my game, when the player overlaps or collides with the enemy it is destroyed. When the player overlaps or collides with the coins, I want the player to be invincible for 5 seconds, so if it collides with the enemy it won't be destroyed for that period of time.
I can't figure out how to do this because no matter what I try, the player always gets destroyed even after colliding with the coins!
Thanks for any help!

Comments

  • bjandthekatzbjandthekatz Orlando, FlMember Posts: 1,375
    Create a Boolean attribute, name it invincible

    In the enemy add a rule, if Invincible is false, (do stuff to kill actor)

    In the coin create a rule, when overlap or collide with player, change attribute Invincible to true.
    After 5 seconds change attribute Imvincible to false.
Sign In or Register to comment.