How do I make my character invincible for a while

0 favourites
  • 6 posts
From the Asset Store
2d warrior machrom platformer game character assets
  • Hi guys, i started using Construct 2 this year, and i need some help!

    I'm trying to make my character immune to damage for a while ( like when you pick up the mario star)

    but it doesn't work

    I have tried disabling the collision for a short period of time, but my character life still drops when a bullet hits him

    How can i make my character invincible for a while??Like, his life wont drop after picking up a specific item, for a short period of time (like 4 seconds of invincibility)

    Thanks for the attention, sorry for my bad english :/

  • Create a variable used to check if the player is invincible, and add an extra condition for any event that damages the player (save for things you want to invincibility to not ignore, like bottomless pits) that checks if the variable = 0, so if it's 1, the event will not run

    Just so that animations and projectiles do not bug up, you may want to wholly include the damage-subtraction in a sub-event by itself under any source where it occurs in your event sheet.

    Edit: you can use the timer behavior to run the duration of the invincibility and with:

    [quote:6828jfzu]>On timer "invincibilitytime"

    Set invincibility-variable = 0

    Keep mind that with the way timers work, the "on timer" will trigger when the timer runs out, just so you know how it properly works to understand how to utilize it correctly.

  • LaDestitute, i am sorry to waste your time, but i tried the way you explained but it didn't work. Can you be a little more specific on the steps that i have to do to make it work? If you want i can attach my project. Im new to Construct 2 and i don't understand exactly what do i have to do

  • Hi guys, i started using Construct 2 this year, and i need some help!

    I'm trying to make my character immune to damage for a while ( like when you pick up the mario star)

    but it doesn't work

    I have tried disabling the collision for a short period of time, but my character life still drops when a bullet hits him

    How can i make my character invincible for a while??Like, his life wont drop after picking up a specific item, for a short period of time (like 4 seconds of invincibility)

    Thanks for the attention, sorry for my bad english :/

    To do this you need to create a variable called invincible and on your events where it will decide wether the player has been hit add a sub event saying if invincible = 0 subtract 1 from lives and when the player equips the invincible power up that lasts for lets say 15 seconds add to the event sheet player on collision with invinciblepowerupobject add 1 to invincible set object invinciblepowerupobject invisible wait 15 secs set invincible to 0

  • Maybe you should read my example a bit more clearly and/or reference the manual for Construct 2 if you're not sure how certain behaviors or plugins work.

    But, I've whipped this up to help you understand more clearly how to do this:

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks everyone, this was really helpful, finally i got it Thanks again for being patient with me!

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