142 lines
3.1 KiB
Plaintext
142 lines
3.1 KiB
Plaintext
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;
|
|
sound_loop(snd_alarms);
|
|
sounder = 1;
|
|
}
|
|
depth = -y;
|
|
life += 1;
|
|
if life > 1000
|
|
{
|
|
life = 1000
|
|
}
|
|
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
|
|
{
|
|
sound_loop(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 = 2;
|
|
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 == 10
|
|
{
|
|
blocks = 20
|
|
repeat (5)
|
|
{
|
|
iii = instance_create(x,y,obj_bullet_enemy);
|
|
with (iii)
|
|
{
|
|
direction = global.manidirs + obj_enemy_boss.blocks;
|
|
speed = 25;
|
|
}
|
|
blocks -= 10;
|
|
}
|
|
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);
|
|
|