An enemy that i made breaks

i tried to fix it and it still was broken. it sometimes goes through walls, and i dont know of why this happens, but, what i mean, is that it works fine for a bit, but then after playing for about 10 seconds or so, they go through walls. maybe its terrible coding from me, but i dont want to code the whole thing from scratch, because i would suffer a lot. also, yes, i do the movement with object variables.

Im almost certain your issue is the “Trigger Once” condition when the enemy hits the wall.

Trigger Once shouldnt be used when you have multiples of the same event being triggered, like different enemies hitting the wall at the same time.

Instead, make an object variable, like a boolean.

Something like…
Enemy is in collision with GoLeft
Enemy boolean “HittingTheWall” is “false”

Change enemy boolean “HittingTheWall” to “true”
and the rest of the action you want.

Then have a different event that resets the boolean like…
Enemy is in collision with GoLeft (Invert the condition so that hes not in collision)
Enemy is in collision with GoRight (Invert as well so that hes not in collision)

Change Enemy boolean “HittinTheWall” to “false”

That should fix your issue :slight_smile:

,as an extra note so you know whats happening…,

When an enemy hits a wall, the event with Trigger Once happens and for as long as one enemy is in collision with the wall, no other enemy is care about the wall and just move thru, because “Trigger Once” is still happening.

When the enemy moves away from the wall, now the other can collide with it and have the actions be taken.

Thats why making object boolean is much better, since it will make every enemy colliding with the wall have their own set of unique events…

I hope that made some sort of sense :slight_smile:

thanks, now it works normally like it would if it was back in the day where everything was well tested before it was released, not like now that games at launch are absolute bug magnets.

1 Like