Ask here your questions to get help using GDevelop.
By Umar
#67596 enemies will come from all sides and attack the base. Now the player can protect some sides by placing some walls. Now how would I make the enemy intelligent enough to know there is a wall which will block the attack (bullets or missiles), so that they have to come from the way? :?
User avatar
By ddabrahim
#67597
ow would I make the enemy intelligent enough to know there is a wall which will block the attack (bullets or missiles), so that they have to come from the way?


You can cast a ray from the position of the enemy toward the angle of the enemy, in case the ray hit a wall, that means there is a wall in-front of the enemy.
Or in case it is restricted and there is only 4 places the player can place the walls, you can just simply hide the walls and make them visible when the player place them, and check if the wall is visible or not and this way you know if there is a wall on that side or not by simply checking if it visible or not.
User avatar
By ddabrahim
#67635
So then how to make the enemy come around to the right side

Did you try pathfinding to move them to a specific location?
There is an example bundled with GDevelop, I believe it called Basic AI with pathfinding.

Instead of checking if the wall is there and if it there then move to the other side..., what I would do is loop through all the walls and check their visibility, if the wall is not visible meaning, there is no wall then simply move the enemy there using pathfinding. Always find a place without a wall instead of checking if there is a wall if you know what I mean. Unfortunately I don't have time to be more detailed about it, I hope the examples bundled with GD can help you to get the idea.