Indestructible for a while

0 favourites
  • 5 posts
  • Hi there,

    I want to make my hero invulnerable for a sec after he colided with an oponent. Unfortunately switching off colisions makes him fall from platforms:/. Is there an easy way to make this happen?

    Thanks!

  • dirty

    If playa touches enemy

    if "took hit" = 0

    takes X from health

    set animation to "taken hit" (can be flash)

    Set "took hit"(variable) to 1

    playa on animation "taken hit" (could be flash stop) stop

    set "took hit" to 0

    Syntax is not correct, i am very drunk

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • scirra.com/manual/128/sub-events

    Dude

    It's in the manual

  • In your event that causes damage to the player, put in a sub event that checks to see if they are currently allowed to take damange. Make a variable called something like playerInvuln and when it is true, do not do damage to the player. When the player gets hit, set playerInvuln to true. Or you could put the event that does the damage into a group and just disable the group whenever damage is done, put on a timer, and then re-enable the group once your preferred amount of time has passed... take your pick...

  • Thanks guys, its working. :) i had it set like this: on collision, take 1 health and add 1 to invulnerability. Unfortunately, it hasn't worked because it added 1 to invul. before it took the health. I had to set a very shor timer between.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)