Invencible when flashing

0 favourites
  • 8 posts
  • Hello, good afternoon :). How do I this?

    In some platform games when you touch an enemy, your character flashes for 2 seconds for example, and in that 2 seconds the enemy can't touch again. I tried with variables, "wait" events and doesn't work :(.

    Please can you help me?

    Thanks a lot.

  • Variables/wait actions should work fine. It is probably a simple problem, we can help you if you share your capx!

  • Hello, here is the capx dropbox.com/s/xlnxcuxbswd08xv/Platform%20Capx.capx.

    The game it's in spanish because it's a large project. However I deleted some objects to make file size smaller and I just keep the important ones (the bee and the player)

    As you can see in the events, when you touch the bee you lose a heart and the variable "invencible" is set to 1.

    When that variable is 1, the group "Player" is deactivated and there is a wait 2 seconds action, then the variable is set to 0

    When the variable is 0, the group is activated again.

    I tried at this way, and when I touch the bee my character flashes for 2 seconds an he becomes invencible while he flashes, but then I can touch the bee constantly and I lose all my hearts, I think it ignores the "wait" action after the first 2 seconds but I'm not sure.

    What are your suggestions? :)

    Thank you very much.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • A simple example: invul example

  • Would adding the condition:

    (player.invincible = 0)

    to the collision between bee and player condition help?

  • Hello, I tried with that condition, but still doesn't work.

    Suggestions?

    Thank you very much :)

  • Actually it's a simple fix.

    Go to where your conditions are for hurting the player. Should be:

    PlayerBox On Collision with Bee

    PlayerBox is on floor

    ---> hurt player

    ---> set invincible to 1, etc...

    Just add "Player private variable "invencible" is = 0. That way each time the bee collides with the player it checks to make sure the player is invincible before doing anything.

    PlayerBox on collision with Bee

    PlayerBox private variable "invencible" = 0

    PlayerBox is on floor

    ---> hurt player

    ---> set playerbox.invencible = 1, etc...

  • I did similar to but used a bollean.

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