V
VR #456
Guest
I need this function for my turret object to prevenet it from aiming and shooting at player, when they are behind the wall.
All codes in turret object:
I tried adding 'if not collision_line(...)' in the beginning of Alarm 0 code, but it resulted in cannon completely stopping shooting after player got behind the wall at least once. Probably I'm missing something?
All codes in turret object:
Create
Alarm 0
Step
Code:
image_speed = 0.5;
alarm[0] = 24;
Code:
var bullet = instance_create(x, y, obj_projectile);
with (bullet)
{
direction = point_direction(x, y, obj_player.x, obj_player.y);
speed = 7;
}
alarm[0] = 24;
Code:
image_angle = point_direction(x,y,obj_player.x,obj_player.y);