Deltarune (Chapter 3) script viewer

← back to main script listing

gml_Object_obj_zapper_laser_manager_Alarm_0

(view raw script w/o annotations or w/e)
1
if (segment == segment_max)
2
{
3
    choice = ds_list_create();
4
    if ((y + 22) > top)
5
        ds_list_add(choice, -1);
6
    if ((y + 22) < bound)
7
        ds_list_add(choice, 1);
8
    ds_list_shuffle(choice);
9
    direct = ds_list_find_value(choice, 0);
10
    ds_list_destroy(choice);
11
    var inter;
12
    if (direct == 1)
13
        inter = bound;
14
    else
15
        inter = top;
16
    if (i_ex(obj_heart))
17
    {
18
        diff = inter - (obj_heart.y + 10);
19
        reflect_angle = point_direction(x + 68, y + 22, obj_heart.x + 10, inter + diff);
20
    }
21
    var force_aim = 0;
22
    if (i_ex(obj_zapper_laser_linedraw))
23
        force_aim = obj_zapper_laser_linedraw.force_aim_counter;
24
    aim_true = false;
25
    if (!(random(99) < (force_aim * 25)) && abs(180 - reflect_angle) < 65)
26
    {
27
        if (!irandom(3))
28
            reflect_angle += irandom_range(-8, 8);
29
        var intersection = 
scr_lines_intersect
scr_lines_intersect

function
scr_lines_intersect()
{ var ua = 0; var ux = argument[2] - argument[0]; var uy = argument[3] - argument[1]; var vx = argument[6] - argument[4]; var vy = argument[7] - argument[5]; var wx = argument[0] - argument[4]; var wy = argument[1] - argument[5]; var ud = (vy * ux) - (vx * uy); if (ud != 0) { ua = ((vx * wy) - (vy * wx)) / ud; if (argument[8]) { var ub = ((ux * wy) - (uy * wx)) / ud; if (ua < 0 || ua > 1 || ub < 0 || ub > 1) ua = 0; } } return ua; }
(x + 68, y + 22, x + 68 + lengthdir_x(480, reflect_angle), y + 22 + lengthdir_y(480, reflect_angle), obj_growtangle.x - 165, inter, obj_growtangle.x + 165, inter, true);
30
        if (intersection <= 0 || intersection > 1)
31
        {
32
            if (direct == 1)
33
                inter = top;
34
            else
35
                inter = bound;
36
            if (i_ex(obj_heart))
37
            {
38
                diff = inter - (obj_heart.y + 10);
39
                reflect_angle = point_direction(x + 68, y + 22, obj_heart.x + 10, inter + diff);
40
            }
41
        }
42
        if (abs(180 - reflect_angle) < 65)
43
        {
44
            with (obj_zapper_laser_linedraw)
45
                force_aim_counter++;
46
        }
47
        else
48
        {
49
            aim_true = true;
50
        }
51
    }
52
    else
53
    {
54
        aim_true = true;
55
    }
56
    if (aim_true)
57
    {
58
        reflect_angle = 
scr_at_player
scr_at_player

function
scr_at_player(arg0 = x, arg1 = y)
{ return point_direction(arg0, arg1, obj_heart.x + 10, obj_heart.y + 10); }
(x + 68, y + 22);
59
        with (obj_zapper_laser_linedraw)
60
            force_aim_counter = 0;
61
        if (irandom(2))
62
        {
63
            var imprecision = random_range(-22.5, 22.5);
64
            for (angl = 3; angl > 0; angl--)
65
            {
66
                var imprecision_offset = imprecision * (angl / 3);
67
                var imprecise_angle = reflect_angle + imprecision_offset;
68
                if (collision_line(x + 68, y + 22, x + 68 + lengthdir_x(480, imprecise_angle), y + 22 + lengthdir_y(480, imprecise_angle), obj_growtangle, false, true))
69
                {
70
                    if (abs(180 - imprecise_angle) > 65)
71
                    {
72
                    }
73
                    else
74
                    {
75
                        reflect_angle = imprecise_angle;
76
                        break;
77
                    }
78
                }
79
            }
80
        }
81
    }
82
    if (nuisance)
83
        reflect_angle = clamp(reflect_angle, 125, 235);
84
    snd_play_x(snd_heartshot_dr_b, 1.4, 0.5);
85
}
86
with (
scr_fire_bullet
scr_fire_bullet

function
scr_fire_bullet(arg0, arg1, arg2, arg3, arg4, arg5 = -4, arg6 = 0, arg7 = false, arg8 = 87135)
{ var bullet; if (arg8 != 87135) bullet = instance_create_depth(arg0, arg1, arg8, arg2); else bullet = instance_create(arg0, arg1, arg2); with (bullet) { direction = arg3; speed = arg4; if (arg5 != -4) sprite_index = arg5; updateimageangle = arg6; if (arg6) image_angle = arg3; if (arg7) { with (other)
scr_bullet_inherit(other.id);
} } return bullet; } function scr_fire_bullet_colorize(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7 = 0) { var bullet = instance_create(arg0, arg1, arg2); with (bullet) { direction = arg3; speed = arg4; sprite_index = arg5; image_blend = arg6; updateimageangle = arg7; if (arg7) image_angle = arg3; } return bullet; }
(x + 68, y + 22, obj_bullet_zapper_laser, reflect_angle, 11 - (1 * nuisance * sameattack) - (1 * sameattack), spr_zapper_laser))
87
{
88
    damage = other.damage;
89
    target = other.target;
90
    depth = (depth - 4) + other.creator;
91
    image_angle = direction;
92
    image_yscale_goal = other.scale_goal;
93
    if (other.segment == other.segment_max)
94
        first = true;
95
    if ((other.segment % 2) == 0 && other.segment > 3)
96
        do_bounce_image = true;
97
    if (i_ex(obj_volumeup))
98
    {
99
        image_yscale *= 1.5;
100
        image_yscale_goal *= 1.5;
101
        grazepoints += 1;
102
        if (i_ex(obj_tenna_board4_enemy))
103
            grazepoints += 2;
104
    }
105
    if (i_ex(obj_tenna_board4_enemy))
106
        grazepoints += 1;
107
}
108
segment--;
109
if (segment < 5)
110
    scale_goal -= 0.2;
111
if (segment)
112
{
113
    alarm[0]
 = 1;
gml_Object_obj_zapper_laser_manager_Alarm_0.gml

if (segment == segment_max) { choice = ds_list_create(); if ((y + 22) > top) ds_list_add(choice, -1); if ((y + 22) < bound) ds_list_add(choice, 1); ds_list_shuffle(choice); direct = ds_list_find_value(choice, 0); ds_list_destroy(choice); var inter; if (direct == 1) inter = bound; else inter = top; if (i_ex(obj_heart)) { diff = inter - (obj_heart.y + 10); reflect_angle = point_direction(x + 68, y + 22, obj_heart.x + 10, inter + diff); } var force_aim = 0; if (i_ex(obj_zapper_laser_linedraw)) force_aim = obj_zapper_laser_linedraw.force_aim_counter; aim_true = false; if (!(random(99) < (force_aim * 25)) && abs(180 - reflect_angle) < 65) { if (!irandom(3)) reflect_angle += irandom_range(-8, 8); var intersection =
scr_lines_intersect(x + 68, y + 22, x + 68 + lengthdir_x(480, reflect_angle), y + 22 + lengthdir_y(480, reflect_angle), obj_growtangle.x - 165, inter, obj_growtangle.x + 165, inter, true);
if (intersection <= 0 || intersection > 1) { if (direct == 1) inter = top; else inter = bound; if (i_ex(obj_heart)) { diff = inter - (obj_heart.y + 10); reflect_angle = point_direction(x + 68, y + 22, obj_heart.x + 10, inter + diff); } } if (abs(180 - reflect_angle) < 65) { with (obj_zapper_laser_linedraw) force_aim_counter++; } else { aim_true = true; } } else { aim_true = true; } if (aim_true) { reflect_angle =
scr_at_player(x + 68, y + 22);
with (obj_zapper_laser_linedraw) force_aim_counter = 0; if (irandom(2)) { var imprecision = random_range(-22.5, 22.5); for (angl = 3; angl > 0; angl--) { var imprecision_offset = imprecision * (angl / 3); var imprecise_angle = reflect_angle + imprecision_offset; if (collision_line(x + 68, y + 22, x + 68 + lengthdir_x(480, imprecise_angle), y + 22 + lengthdir_y(480, imprecise_angle), obj_growtangle, false, true)) { if (abs(180 - imprecise_angle) > 65) { } else { reflect_angle = imprecise_angle; break; } } } } } if (nuisance) reflect_angle = clamp(reflect_angle, 125, 235); snd_play_x(snd_heartshot_dr_b, 1.4, 0.5); } with (
scr_fire_bullet(x + 68, y + 22, obj_bullet_zapper_laser, reflect_angle, 11 - (1 * nuisance * sameattack) - (1 * sameattack), spr_zapper_laser))
{ damage = other.damage; target = other.target; depth = (depth - 4) + other.creator; image_angle = direction; image_yscale_goal = other.scale_goal; if (other.segment == other.segment_max) first = true; if ((other.segment % 2) == 0 && other.segment > 3) do_bounce_image = true; if (i_ex(obj_volumeup)) { image_yscale *= 1.5; image_yscale_goal *= 1.5; grazepoints += 1; ...
114
}
115
else if (global.turntimer > (12 + segment_max + ((2 + (10 * sameattack) + (nuisance * 6)) * 2)))
116
{
117
    alarm[0]
 = 2 + (10 * sameattack) + (nuisance * 12);
gml_Object_obj_zapper_laser_manager_Alarm_0.gml

if (segment == segment_max) { choice = ds_list_create(); if ((y + 22) > top) ds_list_add(choice, -1); if ((y + 22) < bound) ds_list_add(choice, 1); ds_list_shuffle(choice); direct = ds_list_find_value(choice, 0); ds_list_destroy(choice); var inter; if (direct == 1) inter = bound; else inter = top; if (i_ex(obj_heart)) { diff = inter - (obj_heart.y + 10); reflect_angle = point_direction(x + 68, y + 22, obj_heart.x + 10, inter + diff); } var force_aim = 0; if (i_ex(obj_zapper_laser_linedraw)) force_aim = obj_zapper_laser_linedraw.force_aim_counter; aim_true = false; if (!(random(99) < (force_aim * 25)) && abs(180 - reflect_angle) < 65) { if (!irandom(3)) reflect_angle += irandom_range(-8, 8); var intersection =
scr_lines_intersect(x + 68, y + 22, x + 68 + lengthdir_x(480, reflect_angle), y + 22 + lengthdir_y(480, reflect_angle), obj_growtangle.x - 165, inter, obj_growtangle.x + 165, inter, true);
if (intersection <= 0 || intersection > 1) { if (direct == 1) inter = top; else inter = bound; if (i_ex(obj_heart)) { diff = inter - (obj_heart.y + 10); reflect_angle = point_direction(x + 68, y + 22, obj_heart.x + 10, inter + diff); } } if (abs(180 - reflect_angle) < 65) { with (obj_zapper_laser_linedraw) force_aim_counter++; } else { aim_true = true; } } else { aim_true = true; } if (aim_true) { reflect_angle =
scr_at_player(x + 68, y + 22);
with (obj_zapper_laser_linedraw) force_aim_counter = 0; if (irandom(2)) { var imprecision = random_range(-22.5, 22.5); for (angl = 3; angl > 0; angl--) { var imprecision_offset = imprecision * (angl / 3); var imprecise_angle = reflect_angle + imprecision_offset; if (collision_line(x + 68, y + 22, x + 68 + lengthdir_x(480, imprecise_angle), y + 22 + lengthdir_y(480, imprecise_angle), obj_growtangle, false, true)) { if (abs(180 - imprecise_angle) > 65) { } else { reflect_angle = imprecise_angle; break; } } } } } if (nuisance) reflect_angle = clamp(reflect_angle, 125, 235); snd_play_x(snd_heartshot_dr_b, 1.4, 0.5); } with (
scr_fire_bullet(x + 68, y + 22, obj_bullet_zapper_laser, reflect_angle, 11 - (1 * nuisance * sameattack) - (1 * sameattack), spr_zapper_laser))
{ damage = other.damage; target = other.target; depth = (depth - 4) + other.creator; image_angle = direction; image_yscale_goal = other.scale_goal; if (other.segment == other.segment_max) first = true; if ((other.segment % 2) == 0 && other.segment > 3) do_bounce_image = true; if (i_ex(obj_volumeup)) { image_yscale *= 1.5; image_yscale_goal *= 1.5; grazepoints += 1; ...
118
    segment = segment_max;
119
    scale_goal = 1;
120
}