player invinciblity

0 favourites
  • 12 posts
From the Asset Store
Basic Rounded Vector Geometry Player Design with Glow for 3 player games
  • I am having an issue with my change states for my player when he gets hit.

    Right now when he collides with something it randomly takes off hearts..it could be one or all 3...I am not sure how to make my player invincible for a small time period after collision with the enemy....

  • Try a switch case.

    Or make one event "every 3 seconds" and ask for the playerHealth in a Subevent.

  • dwbailey.com/images/healthevent.capx

    not sure what you mean by one event for the every 3 seconds..here is the capx.

  • if you have flash effect i have made a rather simple off on switch for invincibility

    put all the monsters in a group

    or put your collisions with the monsters in a group.

    when your character is flashing turn off the group that causes you to take damage.

    If character is flashing -->> Turn off group Monster is hitting me

    and

    Character on Flash end -->> Turn on group Monster is hitting me

    basically as long as your flashing you cannot take damage or get hit!

    give it a try

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Move your "subtract 1 from health" action down to the section that has "every 3 seconds"

    Right now its happening "every tick" so that's why its random why sometimes its taking 1 heart and sometimes more.

  • i tried it this way and couldnt get it to work..

    Hey justifun....you said move subtract 1 from health down to where it has every 3 seconds.....should i put that at each state change.

  • Justifun means what i said before. Now every tick when the player is in collision with an enemy, it subtracts 1. You could add the every 3 seconds condition to the "on collision with enemy" event.

  • Is there anyway someone from here can open that capx and get it to work so I can see exactly what to do...right now everything I tried just gets horrible results....also I am not sure why the isinvisible var doesnt do the trick?

  • to get the every x sec to work...does it need an every tick in the beginning?

  • Simply add the "Idle is not flashing" condition to the collision check event.

    You don't need the global variable "IsFlashing" at all to achieve this.

  • thanks for the help guys...it seems to work, not sure why I have to make things harder than they are...

    now im having an issue with the sound going off even when the flashing is occuring...did I place the sound Action in the wrong spot?

  • dwbailey.com/images/hearts

    some reason it the invicibility still feels funny...

    I run into the squirrel and get hit,,, it flashes...after the flash is over...as long as I am overlapping the squirrel, it wont hurt me because I havent recollided with it....so doees this mean I need to put an overlapping even on it?

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