Enemy movement issue (SOLVED)

What do you mean by console?

image

Click the debug button, choose “Start Preview with Debugger and Performance Profiler”, run the game and in the debug tab you’ll have the console action output

Okay, i’ll give it a shot whenever I can. I currently got college to deal with right now.

I used the debugger, and I discovered that when the enemy touches the wall, it keeps changing the direction variable from 1 to 0 to 1 over and over again. that’s why it’s not moving.

How do I stop this?

I’m not sure, and I’m only speculating here- it could be the simulate keypress is queued as an action, and gets processed after the separate objects. (there are game engines that have an order in their processing - physics, I/O, user input, display etc - and so things don’t always run as expected). Because it seems like the collision is detected, the enemy is moved away and direction swapped, but then the enemy moves in the wrong direction and back into the wall, starting the whole cycle again.

Could you move the turn around events so they occur before the simulate keypress events? So a collision check between enemy and wall/gaps and direction change is done first, and then the enemy directional movement is done.

1 Like

It worked!!! :grinning_face_with_smiling_eyes:

Thank you, Mr Men!