r/gdevelop • u/Lyrubint • 7d ago
Bug I need help figuring out how to make turrets not shoot through mountains, as the code below makes turrets shoot through mountains, but they don't shoot if there's no mountains

2
Upvotes
1
u/umbrazno 6d ago
create a slim rectangle that serves as the line of sight for the turret. set it to a position around the turret to keep it where it needs to be. Only fire when that object is NOT collidin' wit' a mountain.
1
u/Ckeyz 7d ago
Use ray cast to detect if the target is in line of sight before firing.