Legacy GM Help Enemy Not Shoot If There's a Wall

D

dawson2223

Guest
Hey,

Is there a code that will only let the enemy do something to the player if there isn't any solids in between the enemy and player?

I'm trying to make it so the enemy can only shoot at me if there is no wall that separates us... Can't find the code for it.

Thanks a lot!
 
N

Newt

Guest
Use 'Collision_line' to check if there is an obj_Wall in the way, something like this ircc:

In enemy step event:

if !collision_line(x,y,player.x,player.y, object wall, false,false)
{
//shoot
}
 
D

dawson2223

Guest
I was looking at collision line but wasn't sure if that was the right thing to use. Thanks!!!


Use 'Collision_line' to check if there is an obj_Wall in the way, something like this ircc:

In enemy step event:

if !collision_line(x,y,player.x,player.y, object wall, false,false)
{
//shoot
}
 
Top