Collision - Only Once

I have used the collision in this format per the collision handling wiki page:

Image Link: error.png (383×45)

I am still getting more than a single triggering of the event.


Player (not jumping) collide with enemy, player take 1 hp of damage.

What is happening is upon collision/overlap player HP is reduced to zero because condition is still “true”.

What am I missing?

Hm I would try to add condition when player is in collision with enemy - add force to player to repel it from enemy therefore end collision event…

Add a trigger once while true condition.

Not sure why the image upload did not work, but I am using the Trigger Once and it has not fixed it.

That might have to be what I do, was hoping not to have that type of effect

Tried that, still had multiple triggers.

Can you screen shot a bit more than just the event condition? It’ll be somewhere else in your code that’s causing the problem.

And you can just paste an image into the thread, it’ll get automatically uploaded and included in your message.

You could use a variable, if trigger one does not work.
if Variable of object = 0
->If in collusion
->->action your dmg stuff
->->Change variable of object to 1

If not in collusion trigger once set variable of object to 0

I think there are external factor at play (computer specific) I have the issue on my laptop. I tried to recreate the error to post more of the code here…and the Trigger once works perfectly!

The way trigger once works isn’t always as what is expected - there are certain conditions that one would expect to behave a certain way, but it doesn’t.

To recreate the error, did you have exactly the same events? Or better still, use the same project?

I did everything exactly the same, on both devices. The only difference being which computer I was using. Both are Windows 10 machines…But after some deleting and redoing on the laptop it started working as expected.

Thanks Everybody for helping me think my way through the error!

1 Like