Ok, I'm going to try to be as clear as possible.
I'm basically making a game like Gauntlet.
I have my enemies spawning at spawn points, they have bullet behaviors on them so that they will aim towards the player. However, once they hit a wall (I have it set so that when they hit them, they rotate towards the player) they fly towards the player, regardless of what's in the way including the solid walls. How do I prevent them from doing so? How do I make them recognize that the wall is there, and that they need to go around it to get to the player?
Using Rojohound's path movement behavior would be one possible way to do it.
I'm sorry, I guess I wasn't clear enough. What I need the enemy characters to do is simply not go through the walls. I built mine similarly to the Ghost Shooter tutorial, where they hit something and then rotate towards the player. Does this simply overwrite the "solid" function? Because the enemy characters are really flying thorugh the walls.
Develop games in your browser. Powerful, performant & highly capable.
try adding a "on step" condition combined with a condition that checks if the enemy is overlapping a wall. If so then the action would be to reverse the speed.
Edit: Looks like "On step" is not necessary. A simple check if overlapping (or colliding) and then setting the rotation towards the player will work. and yes it does override the solid attribute.
I've tried that, but it still zooms right through the walls.
I've just switched the enemy movement to ball movement. It fixed the problem, except now it will randomly go through the walls. It will hit several and then go through, or sometimes it will go through the first one. I tried it both with solid and non solid attributes on the enemy object, but that doesn't seem to effect it. I'm so close!!!
It seems to work fine for me. Are you doing something different than this .cap?
Here's what I have. I hope you see something that I can't.
I don't like the ball behavior. Perhaps the latest build (which I haven't updated to yet) fixes the problem but it has always been buggy.
That being said your problem is that your situation is more complex that just bouncing off a wall. If the player gets really close to the wall you have a potential where the enemy will have to overlap the wall in order to approach the player. You will also run into situation where the enemy will fly past the wall as well.
That's why the custom movement/path movement behavior is better for stuff like this. If you don't choose to go with that then you have to add more complex conditions to make sure the enemy is never overlapping the wall.
This seems to be pretty stable:
Thanks so much for your help.
The reason that I'm not using the path movement is because I'm trying to create a game for a camp to teach kids in three hours. The path movement is far too complicated. But this new version seems to be far more stable.