How do I make the system re-read a collision?

0 favourites
  • 3 posts
From the Asset Store
Create complex dialogues with ease with this tool/template!
  • Hello dudes!

    I've got the following issue:

    In my game, the enemies can destroy the player on touch. However, when I use my stun gun on them, they freeze and they are harmless for a few seconds. No issue until here.

    The thing is: when I'm on top of the enemy and it starts moving again, the player does not get harmed. The player is only destroyed if i stop colliding and then collide again: I have either to jump and fall back or go to the floor and walk to it.

    Does anybody no hot to force the system to hurt the player on this situation?

    Here is a stripped down file to show the problem: ... sp=sharing

  • Yeah, in this instance, use "is overlapping". Remember, that's called continuously, so you need a sub-condition to make it do what you want.

    This could be something simple like a private variable on the enemy. Call it something like "stunned". Also, keep track of the player state for future expandability. So give them a variable like "dead".

    if enemy is overlapping player

    and If enemy variable "stunned" = 0

    and if player variable "dead" = 0

    -----> Set player variable "dead" to 1

    -----> Do you death events here. When it's done, reset "dead" to 0.

    That way, it will check if the enemy is both overlapping the player AND if they're not stunned. Once the event happens, you set the player to "dead" = 1 to stop the event from being true a second time. You could modify that pretty easily to add health, too, with an "invulnerable" state/private variable for the player.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Unfortunately, it didn't work.

    I think the problem is that, since the player has Platform Behaviour and the enemy is a solid (or a jump through in some cases) they get to touch each other but they don't overlap, so the issue from before remains.

    Weirdly, though, there is a new symptom with this formula: now the player won't get hurt even if he jumps on the top of the enemy: he only dies if the player touches the enemy on the side.

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