# Pathfinding Enemy not attacking me?

Really confused about this but I have it so the enemy moves to my position when within a certain range BUT if I go near walls he won’t attack. He did attack me against left walls if I put the extra border into -1 or more but not sure what this means at all. Any help would be really appreciated, thanks.

Will the enemy not attack or move towards the player? It is possible that the pathfinding algorithm cannot build a path to the player, since the point for calculation is in the unseen zone (in the wall).
Try to prevent the player’s collision mask from crossing the wall.

Thanks dude I will try that tmw and get back to you. It has me cooked for tonight, he just walks up and stares like a dummy lol.

If it moves, then it’s not about finding a way. To check, try increasing the radius (distance) at which he attacks. Maybe in this case it does not “reach”.

I think these two events are not letting each other work

When you are below 65pixels, the variable changes to 1. But when you are below 65 pixels but the distance between you and enemy is greater than 64 pixels, then it tries to change to both 1 and 2 and neither of them works.
Can you tell me what you are trying to do?

@Muzan I believe this is done so that the enemy does not get too close to the player, so that there is a distance between them.

I’d assume @AdamBarker wants one event for under 65, the other for 65 & over. You’re right, there’s a crossover patch between 64 & 65. The inverted condition should be have the value 65.

I think the solution is to reduce the virtual cell width and heights in the enemy pathfinding behaviour settings. It’s preventing the enemy from completely making it to the player’s position by creating a buffer around the point in the path. I believe, as a result, the pathfinding finds no path, because it cannot get to the player position.

so it seems the issue was grid based! I had to place my obstacles on the grid properly as the pathfinding was getting confused by obstacles being half way through a grid block etc. Thanks again for all the input, it helped me figure this out!

I think it’s a little bit different, but someone correct me if I’ve got this wrong. I think of the cell size as a bubble around pathfinding object (like one of those giant inflatable bumper balls you can wear). That’s what the enemy is wearing and prevents it from getting too close to the player, and the size of that is determined by the virtual cell size.