Cant figure out patrolling enemies

Hello
So, i have been trying to make an enemy that patrolls by changing directions when it colides with an object. It can bounce from the right wall, but it cant on the left one. I dont have any idea of why this is happening, so thats why i seek help.


These are all the events related to the enemy in question

If you think the problem is in the layout, please ask for a photo. I cant put two photos in the same post for some reason.

Any help will be usefull.

As above its better to link movement to a variable. Above there’s a boolean - which you can toggle between false and true. I like to use a number so i can have 0 as stop and 3 for jump left 4 jump right etc.

thanks! now my patrolling enemy works like its supposed to

So, your events were working wonderfully, untill i started coding the rest of the features for the enemy. now, it doesnt change directions when it colides with the right wall, but it does with the left one.


These are all the events that affect the enemy.

Im really confused because i have no idea of why it stoped working.
Please, help me out and let me know what i messed up.

What is condition on very top you cutted out?

Cause these are sub events to something

Next time when you say you show all then show all

BTW
When you right click on event you have option to toggle disable
When you do it event will be strike text
Which will mean this event does not work

And this way you can test which event is causing something bad

Also when you rightclick event there will hotkey next to toggle disable
I changed mine to D r was it by default D but if not this will tell you which key to press to do it without right clicking event each time

Thanks for answering, now i know it is posible to disable events.

But, when i disabled the events, it still wasnt working.

I guess i will just erase everything and start again in case i see what messed it up.
Also, the codithion i cut out is just an event group.
Thanks.

1 Like

BTW nothing in your events look like could disturb patrolling logic

I know, and thats why i asked in this forum, because It just doesnt make sense.

It makes sense if you change something else
I was sitting today like 6h on a bug
To find out i am so stupid checking every single event to find out i simply toggled animation loop in player animations
SIX HOURS

Anyway are rocks wall or also floor?
Cause my method is for topdown for object to collide only on end of route

Where for platofrmer game where wall are both same object so your object you want to patrol would constantly touch them

You would need to use point inside object condition

Don’t worry, rocks is only a wall, not the floor, so that cant be the problem. Also, i have discovered that the events work perfectly fine if i make the enemy bigger.
So i Guess i Will just make It bigger and call it a day.

Let’s check enemy collision mask


This is the colision mask.
I cant see any problem with it, but maybe you can.

This is your problem (RED)

Why did you make image with so much empty space?
You should cut it out
Your sprites as image should be as small as possible

You should have image this big

I need the extra space for the death animation.

So, looks like that was the problem. I have fixed the sprites, and now it works, but this causes a problem with the death animation, causing it to be shown inside the ground , and moved to the Right. If you know how to fix that, please tell me.

Show me your events for how you make death
And collision mask + points of object which is dead


These are the events

This is the colision mask

And these are the points

I told you you should cut empty space from your objects?
Even better
Actually

1 - instead of spamming wait action you could simply tween object opacity
2 - you could have separate object which would have this exact animation which WOULD NOT have so much empty space on image
And just create it when bones die and delete bones itself

Finally, after 9 days, i have made the enemy prefectly functional.
Now, it bounces from the walls without a problem, it has contact damage, and it dies with a cool little animation.

Thanks a lot for helping me.

1 Like