Fortunately, I have already designed a bot that does the exact same.
It is very easy. I can’t give you the code because I lost it.
Even if I had it, you better Do It Yourself so you learn Gdevelop.
Here is how:
You need to use ray cast to detect if the object has a clear line of sight or not.
First, use an object as a collider. (if this object was in front of the bot, it wont shoot.)
Then make a ray cast from the enemy to the player, check for collisions with collider.
If there are collisions don’t shoot, but if there are no collisions, then shoot.
You may use the Fire Bullets behavior, to implement the shooting behavior.
You may use the pathfinding behavior to move the enemy close to the player.
I suggest you read this while making the bot:
Summary of the post above
Ray casts don’t invert their results when you invert the condition!
Use the “not” condition to inverse the result.
Here is how I implemented ray casts for my racing game:
