Enemy refuses to shoot or move

I have an enemy that comes down from the top of the screen and when it reaches the correct Y position it stops going down and instead moves from left to right while shooting sometimes it works, the enemy shoots and moves, but other times they come down and just stand there without shooting or moving.

Does somebody know what I’m doing wrong?

Video of problem
(skip to 1:00)

Hello,

It looks like the issue is with object picking, cz it seems the problem appears when there’s more than 1 enemy instance in the scene. I think a For each object event would fix the problem.

1 Like

The problem is the trigger once when you check if the enemy.Y() >= 31. When the first enemy appears on the screen the condition is true, and get triggered. The condition stays true while the first enemy is on the screen, and so the event isn’t triggered again when the second enemy appears. I’m not sure a repeat for each enemy will fix it.

Instead, set the value of Left_or_right to “” when you create the enemy. Then replace that trigger once with a check whether the Left_or_right = “”. That should sort out the issue.

3 Likes