GGJuanPabon
Member
Sorry in advance, my English is not native language. I want my collision_line, not to go through the walls. Because I don't want the enemy to detect the player behind a wall.
I am making an enemy type IA, if he detects me, he will be alerted, and 2 seconds later, if he is not out of range, he will follow me. But after doing so, I realized that collision_line crosses my wall and if it touches the player behind the wall, it will alert. There is no logic if I leave it that way.
Then I was trying to reduce the size of the end of the line, but for some reason it seems an infinite loop is formed, and my game dies.
What I can do?
Thanks in advance.
I am making an enemy type IA, if he detects me, he will be alerted, and 2 seconds later, if he is not out of range, he will follow me. But after doing so, I realized that collision_line crosses my wall and if it touches the player behind the wall, it will alert. There is no logic if I leave it that way.
Code:
collisionLineaAlert = 100;
endLineAlert = collisionLineaAlert * -image_xscale;
if (collision_line(x, y, x + endLineAlert, y, obj_Ground, false, false))
{
var col = collision_line(x, y, x + endLineAlert, y, obj_Ground, false, false)
while (col)
{
collisionLineaAlert -= 1;
}
}
What I can do?
Thanks in advance.