Enemy Collisions not working

image
So when the enemy hits the “1” block it changes it’s varible to 1 meaning it will move left. Then when the enemy hits the “2” block it changes the variable to 0 meaning it will move to the right.


But for some reason, when i run the game, the enemy does what it’s supposed to do and walks back and fourth but after a while the enemy ignores the collision and just walks through it.

as im writing this, ive been trying to get a clip of it as proof but it doesnt seem to be happening even though i havent changed the code since it was happening before. I still want to see if anyone can help just incase it happens again

Thank you for reading! :slight_smile:

Hello, AndrewHG

Just looking that code I don’t know why sometimes your enemy ignore the blocks. But what I think you can do to discover is:

  • Verify in the rest of your code there is no “lost event” interfering in your enemy movement. You can try to find something using the “search tool” to make it more easier.
  • When your enemy “pass through the enemycollider” you can open the debugger and check the variable, the numbers of the blocks 1 and 2 in the scene, etc.
1 Like