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

Get help using Construct 2

Post » Mon Apr 11, 2016 1:44 am

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:
https://drive.google.com/file/d/0BwT1Zv ... sp=sharing
B
17
S
5
Posts: 16
Reputation: 1,191

Post » Mon Apr 11, 2016 3:40 am

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.
B
103
S
38
G
19
Posts: 962
Reputation: 17,996

Post » Mon Apr 11, 2016 8:49 pm

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.
B
17
S
5
Posts: 16
Reputation: 1,191


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 65 guests