Cause you raycast toward player
And check if it hits the wall like you cast ray toward player but check against wall not playerAnd if it does not hit wall then you fire
Where you would also add condition to check distance between them
What i wrote above is wrong i was thinking about something else
Anyway
This post Raycast Collision - #3 by Points
Give us this link example
(Newer version of this example GDevelop 5)
In which it is solved by placing both wall and player object inside same object group called solid
Checking ray against that group (so both objects)
And using sub event with check if of picked instances of player object is higher than 0
Where it repeats it for each individual ennemy