Deltarune (Chapter 4) script viewer

← back to main script listing

gml_Object_obj_halo_bat_aim_Step_0

(view raw script w/o annotations or w/e)
1
if (!i_ex(obj_growtangle))
2
    exit;
3
if (global.turntimer < 1)
4
{
5
    instance_destroy();
6
    exit;
7
}
8
timer++;
9
var pop = 
scr_monsterpop
scr_monsterpop

function
scr_monsterpop()
{ return global.monster[0] + global.monster[1] + global.monster[2]; }
();
10
if (global.turntimer <= 12 && !skipme)
11
{
12
    if (instance_exists(turn))
13
    {
14
        with (turn)
15
            instance_destroy();
16
    }
17
    temp_x = anchor_x;
18
    temp_y = anchor_y;
19
    
scr_lerpvar_instance
scr_lerpvar_instance

function
scr_lerpvar_instance()
{ __lerpvar = instance_create(0, 0, obj_lerpvar); __lerpvar.target = argument[0]; __lerpvar.varname = argument[1]; __lerpvar.pointa = argument[2]; __lerpvar.pointb = argument[3]; __lerpvar.maxtime = argument[4]; if (argument_count >= 6) __lerpvar.easetype = argument[5]; if (argument_count >= 7) __lerpvar.easeinout = argument[6]; return __lerpvar; } function scr_lerp_var_instance() { if (argument_count >= 6) return
scr_lerpvar_instance(argument0, argument1, argument2, argument3, argument4, argument5);
else if (argument_count >= 7) return
scr_lerpvar_instance(argument0, argument1, argument2, argument3, argument4, argument5, argument6);
else return
scr_lerpvar_instance(argument0, argument1, argument2, argument3, argument4);
} function scr_lerp_instance_var() { if (argument_count >= 6) return
scr_lerpvar_instance(argument0, argument1, argument2, argument3, argument4, argument5);
else if (argument_count >= 7) return
scr_lerpvar_instance(argument0, argument1, argument2, argument3, argument4, argument5, argument6);
else return
scr_lerpvar_instance(argument0, argument1, argument2, argument3, argument4);
}
(id, "x", x, initial_x, 12);
20
    
scr_lerpvar_instance
scr_lerpvar_instance

function
scr_lerpvar_instance()
{ __lerpvar = instance_create(0, 0, obj_lerpvar); __lerpvar.target = argument[0]; __lerpvar.varname = argument[1]; __lerpvar.pointa = argument[2]; __lerpvar.pointb = argument[3]; __lerpvar.maxtime = argument[4]; if (argument_count >= 6) __lerpvar.easetype = argument[5]; if (argument_count >= 7) __lerpvar.easeinout = argument[6]; return __lerpvar; } function scr_lerp_var_instance() { if (argument_count >= 6) return
scr_lerpvar_instance(argument0, argument1, argument2, argument3, argument4, argument5);
else if (argument_count >= 7) return
scr_lerpvar_instance(argument0, argument1, argument2, argument3, argument4, argument5, argument6);
else return
scr_lerpvar_instance(argument0, argument1, argument2, argument3, argument4);
} function scr_lerp_instance_var() { if (argument_count >= 6) return
scr_lerpvar_instance(argument0, argument1, argument2, argument3, argument4, argument5);
else if (argument_count >= 7) return
scr_lerpvar_instance(argument0, argument1, argument2, argument3, argument4, argument5, argument6);
else return
scr_lerpvar_instance(argument0, argument1, argument2, argument3, argument4);
}
(id, "y", y, initial_y, 12);
21
    speed = 0;
22
    direction = 0;
23
    skipme = true;
24
    timer = 0;
25
}
26
if (skipme)
27
{
28
    image_angle = lerp(image_angle, 360, timer / 12);
29
    exit;
30
}
31
if (pop == sameattack)
32
{
33
    if (pop == 1)
34
    {
35
        range = 100;
36
        anchor_y = obj_growtangle.y;
37
    }
38
    if (pop == 2)
39
    {
40
        range = 50;
41
        switch (sameattacker)
42
        {
43
            case 0:
44
                anchor_y = obj_growtangle.y - 60;
45
                break;
46
            case 1:
47
                anchor_y = obj_growtangle.y + 60;
48
                break;
49
        }
50
    }
51
}
52
if (timer == 24)
53
{
54
    temp_x = anchor_x + irandom_range(-20, 60);
55
    temp_y = anchor_y + irandom_range(-range, range);
56
    if (sameattack < 2 || irandom(2))
57
        temp_angle = point_direction(temp_x, temp_y, obj_heart.x, obj_heart.y) + irandom_range(-6, 6);
58
    else
59
        temp_angle = point_direction(temp_x, temp_y, obj_growtangle.x - (obj_growtangle.sprite_width / 2), obj_growtangle.y);
60
    turn = 
scr_lerpvar_instance
scr_lerpvar_instance

function
scr_lerpvar_instance()
{ __lerpvar = instance_create(0, 0, obj_lerpvar); __lerpvar.target = argument[0]; __lerpvar.varname = argument[1]; __lerpvar.pointa = argument[2]; __lerpvar.pointb = argument[3]; __lerpvar.maxtime = argument[4]; if (argument_count >= 6) __lerpvar.easetype = argument[5]; if (argument_count >= 7) __lerpvar.easeinout = argument[6]; return __lerpvar; } function scr_lerp_var_instance() { if (argument_count >= 6) return
scr_lerpvar_instance(argument0, argument1, argument2, argument3, argument4, argument5);
else if (argument_count >= 7) return
scr_lerpvar_instance(argument0, argument1, argument2, argument3, argument4, argument5, argument6);
else return
scr_lerpvar_instance(argument0, argument1, argument2, argument3, argument4);
} function scr_lerp_instance_var() { if (argument_count >= 6) return
scr_lerpvar_instance(argument0, argument1, argument2, argument3, argument4, argument5);
else if (argument_count >= 7) return
scr_lerpvar_instance(argument0, argument1, argument2, argument3, argument4, argument5, argument6);
else return
scr_lerpvar_instance(argument0, argument1, argument2, argument3, argument4);
}
(id, "image_angle", image_angle, temp_angle + 90, 10);
61
}
62
if (timer == 19)
63
    save_angle = image_angle;
64
if (timer >= 19 && timer < 24 && first_turn == false)
65
    image_angle = lerp(image_angle, save_angle - 30, (timer - 19) / 5);
66
if (timer >= 24 && timer < 34)
67
{
68
    first_turn = true;
69
    image_angle = lerp(image_angle, temp_angle + 90, (timer - 24) / 10);
70
}
71
if (timer == 34)
72
    greenflash = 1;
73
if (timer >= 34 && timer < 39)
74
{
75
    direction = temp_angle;
76
    speed -= 0.2;
77
    savex = x;
78
    savey = y;
79
    targetx = x + lengthdir_x(100, direction);
80
    targtey = y + lengthdir_y(100, direction);
81
}
82
if (timer >= 39 && timer <= 42)
83
{
84
    speed = 0;
85
    timer2++;
86
    x = lerp(savex, targetx, timer2 / 4);
87
    y = lerp(savey, targtey, timer2 / 4);
88
    if (timer >= 39 && timer <= 41)
89
    {
90
        a = 
scr_afterimage
scr_afterimage

function
scr_afterimage()
{ afterimage = instance_create(x, y, obj_afterimage); afterimage.sprite_index = sprite_index; afterimage.image_index = image_index; afterimage.image_blend = image_blend; afterimage.image_speed = 0; afterimage.depth = depth; afterimage.image_xscale = image_xscale; afterimage.image_yscale = image_yscale; afterimage.image_angle = image_angle; return afterimage; }
();
91
        a.fadeSpeed = 0.1;
92
    }
93
    if (timer == 39)
94
        snd_play(motor_upper_quick_high);
95
}
96
else
97
{
98
    timer2 = 0;
99
}
100
if (timer == 42)
101
{
102
    var t_x = x + lengthdir_x(48, temp_angle);
103
    var t_y = y + lengthdir_y(48, temp_angle);
104
    if (pop == sameattack)
105
    {
106
        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; }
(t_x, t_y, obj_regularbullet, temp_angle, (3.75 - (0.5 * pop)) + (0.25 * sameattacker), spr_bullet_batstab))
107
        {
108
            damage = other.damage;
109
            target = other.target;
110
            grazepoints = 2.5;
111
            image_angle = other.temp_angle;
112
            gravity_direction = direction;
113
            friction = -0.035;
114
            if (pop > other.sameattack)
115
                friction += 0.015;
116
        }
117
        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; }
(t_x + lengthdir_x(40, temp_angle - 155), t_y + lengthdir_y(40, temp_angle - 155), obj_regularbullet, temp_angle - 3 - (pop * 3), (7.25 - (0.5 * pop)) + (0.25 * sameattacker), spr_bullet_batstab))
118
        {
119
            damage = other.damage;
120
            target = other.target;
121
            grazepoints = 2.5;
122
            image_angle = other.temp_angle;
123
            gravity_direction = direction;
124
            friction = -0.035;
125
            if (pop > other.sameattack)
126
                friction += 0.015;
127
        }
128
        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; }
(t_x + lengthdir_x(80, temp_angle - 155), t_y + lengthdir_y(80, temp_angle - 155), obj_regularbullet, temp_angle - 6 - (pop * 3), (10.75 - (0.5 * pop)) + (0.25 * sameattacker), spr_bullet_batstab))
129
        {
130
            damage = other.damage;
131
            target = other.target;
132
            grazepoints = 2.5;
133
            image_angle = other.temp_angle;
134
            gravity_direction = direction;
135
            friction = -0.035;
136
            if (pop > other.sameattack)
137
                friction += 0.015;
138
        }
139
        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; }
(t_x + lengthdir_x(40, temp_angle + 155), t_y + lengthdir_y(40, temp_angle + 155), obj_regularbullet, temp_angle + 3 + (pop * 3), (7.25 - (0.5 * pop)) + (0.25 * sameattacker), spr_bullet_batstab))
140
        {
141
            damage = other.damage;
142
            target = other.target;
143
            grazepoints = 2.5;
144
            image_angle = other.temp_angle;
145
            gravity_direction = direction;
146
            friction = -0.035;
147
            if (pop > other.sameattack)
148
                friction += 0.015;
149
        }
150
        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; }
(t_x + lengthdir_x(80, temp_angle + 155), t_y + lengthdir_y(80, temp_angle + 155), obj_regularbullet, temp_angle + 6 + (pop * 3), (10.75 - (0.5 * pop)) + (0.25 * sameattacker), spr_bullet_batstab))
151
        {
152
            damage = other.damage;
153
            target = other.target;
154
            grazepoints = 2.5;
155
            image_angle = other.temp_angle;
156
            gravity_direction = direction;
157
            friction = -0.035;
158
            if (pop > other.sameattack)
159
                friction += 0.015;
160
        }
161
    }
162
    else
163
    {
164
        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; }
(t_x, t_y, obj_regularbullet, temp_angle, (3.75 - (0.5 * pop)) + (0.25 * sameattacker), spr_bullet_batstab))
165
        {
166
            damage = other.damage;
167
            target = other.target;
168
            grazepoints = 2.5;
169
            image_angle = other.temp_angle;
170
            gravity_direction = direction;
171
            friction = -0.035;
172
            if (pop > other.sameattack)
173
                friction += 0.015;
174
        }
175
        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; }
(t_x + lengthdir_x(80, temp_angle - 170), t_y + lengthdir_y(80, temp_angle - 170), obj_regularbullet, temp_angle - 3 - (pop * 3), (7.25 - (0.5 * pop)) + (0.25 * sameattacker), spr_bullet_batstab))
176
        {
177
            damage = other.damage;
178
            target = other.target;
179
            grazepoints = 2.5;
180
            image_angle = other.temp_angle;
181
            gravity_direction = direction;
182
            friction = -0.035;
183
            if (pop > other.sameattack)
184
                friction += 0.015;
185
        }
186
        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; }
(t_x + lengthdir_x(80, temp_angle + 170), t_y + lengthdir_y(80, temp_angle + 170), obj_regularbullet, temp_angle + 3 + (pop * 3), (7.25 - (0.5 * pop)) + (0.25 * sameattacker), spr_bullet_batstab))
187
        {
188
            damage = other.damage;
189
            target = other.target;
190
            grazepoints = 2.5;
191
            image_angle = other.temp_angle;
192
            gravity_direction = direction;
193
            friction = -0.035;
194
            if (pop > other.sameattack)
195
                friction += 0.015;
196
        }
197
    }
198
}
199
if (speed < 0.1)
200
{
201
    if (timer > 42)
202
    {
203
        y = 
scr_approach_curve
scr_approach_curve

function
scr_approach_curve(arg0, arg1, arg2, arg3 = 0.1)
{ return
scr_approach(arg0, arg1, max(arg3, abs(arg1 - arg0) / arg2));
}
(y, y + (sin(timer * 0.1) * 8), 12);
204
    }
205
    else
206
    {
207
        x = 
scr_approach_curve
scr_approach_curve

function
scr_approach_curve(arg0, arg1, arg2, arg3 = 0.1)
{ return
scr_approach(arg0, arg1, max(arg3, abs(arg1 - arg0) / arg2));
}
(x, temp_x, 8);
208
        y = 
scr_approach_curve
scr_approach_curve

function
scr_approach_curve(arg0, arg1, arg2, arg3 = 0.1)
{ return
scr_approach(arg0, arg1, max(arg3, abs(arg1 - arg0) / arg2));
}
(y, temp_y, 8);
209
    }
210
}
211
if (sameattack == pop)
212
{
213
    if (pop == 1)
214
        timer_limit = 48 * ratio;
215
    else
216
        timer_limit = 40 + (24 * ratio);
217
}
218
else
219
{
220
    timer_limit = 34 * ratio;
221
}
222
if (timer >= timer_limit)
223
{
224
    speed = 0;
225
    timer = 20;
226
}