if hit = 1 { life -= 100 if alarms = 0 { life -= 100 if distance_to_object(obj_player) < 1 { life -= 500; global.ammos += 1; } } hit = 0 alarms = 3; if life > 0 and sounder = 0 and !sound_isplaying(snd_alarms) { sounder = 1 sound_play(snd_alarms); } } depth = -y; life += 1; if life > 250 { life = 250 } if life < 1 instance_destroy(); if point_direction(x,y,obj_player.x,obj_player.y) > direction-60 and point_direction(x,y,obj_player.x,obj_player.y) < direction+60 and !collision_line(x,y,obj_player.x,obj_player.y,obj_walls,false,true) { alarms = 3; if sounder != 1 and !sound_isplaying(snd_alarms) { sound_play(snd_alarms); sounder = 1; } lnp_x = obj_player.x; lnp_y = obj_player.y; if point_distance(x,y,lnp_x,lnp_y) >= 40 { speed = .25; if point_direction(x,y,lnp_x,lnp_y) > direction + 9 { direction -= 5; } if point_direction(x,y,lnp_x,lnp_y) < direction - 9 { direction += 5; } } shots += 1 global.manidirs = direction if shots == 15 { iii = instance_create(x,y,obj_bullet_enemy); with (iii) { direction = global.manidirs; speed = 25; } shots = 0 sound_play(snd_bullet_1); sound_play(snd_bullet_2); } } else { if alarms == 3 { if (!point_direction(x,y,obj_player.x,obj_player.y) > direction-60 or !point_direction(x,y,obj_player.x,obj_player.y) < direction+60) or collision_line(x,y,obj_player.x,obj_player.y,obj_walls,false,true) { alarms = 2 } } if alarms == 2 { alarms = 1; cooldown = 360; } if alarms == 1 { if cooldown < 300 { sounder = 0; } if (x > lnp_x + 40 or x < lnp_x - 40) and (y > lnp_y + 40 or y < lnp_y - 40) { move_towards_point(lnp_x,lnp_y,.25); } else { direction += 2; speed = 0; } cooldown -= 1; if cooldown <= 0 { cooldown = 0; alarms = 0; } } } if (place_meeting(x+hspeed,y,obj_walls)) { repeat(abs(hspeed)) { if (!place_meeting(x+sign(hspeed),y,obj_walls)) { x += sign(hspeed); } else { break; } } hspeed = 0; } if (place_meeting(x,y+vspeed,obj_walls)) { repeat(abs(vspeed)) { if (!place_meeting(x,y+sign(vspeed),obj_walls)) { y += sign(vspeed); } else { break; } } vspeed = 0; } image_index = round(direction / 360 * 16);