How know if a Wall is between 2 objects

T

TheKingLEF

Guest
Hello , i need help : I have a enemy who go on my player object why his pathfinding and when he is at range he stop and shot arrow, My problem is i need to know how know if the place between the ennemy and the player is free of Wall . Actualy is a Wall is between the enemy and the player he enemy shot in the wall.

this is my code :

scriptEnemyRotate() ///8 directionnal

distToPlayer = point_distance(x, y, oPlayer.x, oPlayer.y);
if( distToPlayer > range-100)
{

mp_potential_settings(45, 5, 5, 0)
mp_potential_step(oPlayer.x,oPlayer.y,spd,0)

}


///shoting
if ( distToPlayer <= range) && shoting=0
{
shoting=1
if shoting=1
{
shoting=2
alarm[1]=shotspd

instance_create_layer(x,y,"enemyshot",oArrowenemy)
}
}
 
Top