How to Hide Player from Ennemy ?

1 favourites
  • 5 posts
From the Asset Store
Basic Rounded Vector Geometry Player Design with Glow for 3 player games
  • I want to make a platform horror game and the ennemy can kill the player if he touch him.

    So i want to know, how to hide my player so the ennemy can't touch him ?

    Hide under a table, a bed...etc.

    I new to construct 3 can you help me please ?

  • Hi Doflanico,

    I'm still fairly new to Construct myself, but I think the easiest way to do this would be to use an instance variable on your player sprite, call the variable something like 'Hidden' and default to 0.

    Add an action to set the variable to 1 when they hide, and set the event where your enemy sprite kills the player to check this variable, and if hidden=1 it doesn't trigger

  • Thank you but can you show me on the even sheet how it looks ?

    Sorry but don't really know how to do it

    I want to hide under a bed only if i press a key and if i'm on collision with the bed.

  • No problem, here's a quick example.

    drive.google.com/file/d/1aA8BgPh9VGMuIjVko1eVC5zye1leriks/view

    The 'enemy' sprite will pace left to right and if it overlaps with the 'player' sprite, while the player sprite's 'hidden' variable is at 0 it will destroy the sprite (you can replace that action with any animation you may want to add)

    The player sprite can be moved left or right with A & D on the keyboard, and when the player sprite is overlapping the 'bed' sprite and W is pressed, the 'player' sprite will set it's position to the 'bed' sprite and go to the bottom of the layer, physically hiding it from site. It also changed the 'hidden' variable to 1, so if the enemy sprite now overlaps it, it won't trigger the destroy action.

    Pressing W again, triggers another action that reverses the hiding. Again you can replace these action with whatever animation you have in mind, it is just the action of changing the 'hidden' variable to 1 that matters.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thank u so much you are the best !

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