Hi.Im creating a simple dungeon game where is shop in middle of map.
Around shop are walls bc if is wave shop is closed and player cant hide there;
My problem is i have simple ai movment.
Enemy is moving toward player but if player is on other side of shop or if player moves around store when is wave enemy is stuck in wall.
Any easy way to fix this?
My idea was create boost zone around walls if enemy enter he will be boosted in random direction.
You’re idea is possible but not ideal, if you don’t want to implement some form of A* what i’d do is give the enemies raycast “antenna” in a V shape to see if we can move forward and if not what way to turn.
Do note that your level design should accommodate this(IE no dead ends and weird paths), you map sounds like a box within a box and that should work just fine and dandy for a thing like that
Yes my map is like you said box and there is box shop.
I tried what you say but i get some weird ray cast hit due to my map is create of tiles.
Should i create invisible object on my tile walls and check detection on it?
what you’re saying is that you detect the floor?
ray cast from the center point(not the pivot that is probably on the ground) of the characters (say they are 2 units tall, raycast from 1 unit high)
I have 2 tilemaps one walls of shop and second is floor.
It is detecting walls of shop tile map have tilemap collilider.
When i tried Debug.DrawLine(transform.position , rc.point , Color.Red);
The line went to whole tile map no separated tiles.
oh, i forgot mid-post your talking about 2D, i’m not the guy to answer that, sorry, haha