Deltarune (Chapter 4) script viewer

← back to main script listing

gml_Object_obj_mike_combo_Step_0

(view raw script w/o annotations or w/e)
1
if (phase == 0)
2
{
3
    xs = 1 + lengthdir_x(0.1, current_time / 4);
4
    ys = 1 - lengthdir_y(0.1, current_time / 4);
5
}
6
if ((hp < (hp_max * 0.5) && rot_speed > 1) || phase == 2)
7
{
8
    var a = 
scr_afterimagefast
scr_afterimagefast

function
scr_afterimagefast()
{ 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; afterimage.fadeSpeed = 0.08; return afterimage; }
();
9
    a.image_xscale = image_xscale * xs;
10
    a.image_yscale = image_yscale * ys;
11
    a.image_angle = image_angle;
12
    a.fadeSpeed = 0.4;
13
}
14
if (action > 0 || phase == 2 || (phase == 1 && action == 0))
15
{
16
    image_angle += rot_speed;
17
    image_xscale += (((2 * xs) - image_xscale) * 0.2);
18
    image_yscale = image_xscale;
19
    cooldown -= 1;
20
}
21
if (phase == 0)
22
{
23
    if (action > 2)
24
    {
25
        if (hp > 3 && hp < hp_max)
26
            hp = 
scr_approach
scr_approach

function
scr_approach(arg0, arg1, arg2)
{ if (arg0 < arg1) { arg0 += arg2; if (arg0 > arg1) return arg1; } else { arg0 -= arg2; if (arg0 < arg1) return arg1; } return arg0; }
(hp, 3, dot);
27
    }
28
    if (action == 0)
29
    {
30
        with (obj_mike_battle)
31
        {
32
            x += ((other.x - x) * 0.1);
33
            y += ((other.y - y) * 0.1);
34
            action = 3;
35
        }
36
        circle_scale = 
scr_approach
scr_approach

function
scr_approach(arg0, arg1, arg2)
{ if (arg0 < arg1) { arg0 += arg2; if (arg0 > arg1) return arg1; } else { arg0 -= arg2; if (arg0 < arg1) return arg1; } return arg0; }
(circle_scale, 200, 3);
37
        if (circle_scale == 200)
38
        {
39
            action = 1;
40
            with (obj_mike_battle)
41
            {
42
                visible = false;
43
                move = true;
44
                action = 0;
45
                var a = snd_play(snd_boost);
46
                sound_volume(a, 0.5, 0);
47
            }
48
        }
49
    }
50
    if (action == 1)
51
    {
52
        circle_scale += circle_speed;
53
        circle_speed += 1;
54
        circle_alpha -= 0.05;
55
        if (circle_alpha <= 0)
56
        {
57
            action = 2;
58
            with (obj_mike_attack_controller)
59
                wave = 1;
60
        }
61
    }
62
    if (action == 2)
63
    {
64
        timer += 1;
65
        if (timer > 15)
66
            y += (((cameray() + 100) - y) * 0.2);
67
        if (timer > 30)
68
        {
69
            action = 3;
70
            timer = 0;
71
            with (obj_mike_attack_controller)
72
                wave = 2;
73
        }
74
    }
75
    if (hp < 3)
76
    {
77
        timer = 0;
78
        action = 0;
79
        phase = 1;
80
        exit;
81
    }
82
    if (action == 3)
83
    {
84
        rot_speed2 = 
scr_approach
scr_approach

function
scr_approach(arg0, arg1, arg2)
{ if (arg0 < arg1) { arg0 += arg2; if (arg0 > arg1) return arg1; } else { arg0 -= arg2; if (arg0 < arg1) return arg1; } return arg0; }
(rot_speed2, 2 + ((1 - (hp / hp_max)) * 2), 1);
85
        rot_speed += ((rot_speed2 - rot_speed) * 0.2);
86
        counter += (0.05 + ((1 - (hp / hp_max)) * 0.2));
87
        xx = camerax() + (camerawidth() / 2) + (cos(counter) * 160);
88
        x += ((xx - x) * spd);
89
        spd = 
scr_approach
scr_approach

function
scr_approach(arg0, arg1, arg2)
{ if (arg0 < arg1) { arg0 += arg2; if (arg0 > arg1) return arg1; } else { arg0 -= arg2; if (arg0 < arg1) return arg1; } return arg0; }
(spd, 0.5, 0.01);
90
        timer += 1;
91
        if (timer >= attack_timer)
92
        {
93
            action = 4;
94
            timer = spin_timer;
95
            with (obj_mike_attack_controller)
96
            {
97
                counter = other.timer;
98
                x = other.x;
99
            }
100
        }
101
    }
102
    if (action == 4)
103
    {
104
        rot_speed += spin_speed;
105
        timer -= 1;
106
        if (timer <= 0)
107
        {
108
            action = 5;
109
            sound_play(snd_screenshake);
110
            active = true;
111
        }
112
    }
113
    if (action == 5)
114
    {
115
        timer += 1;
116
        if (timer > 45)
117
        {
118
            y += (((cameray() + 80) - y) * 0.2);
119
            if (timer > 60)
120
            {
121
                timer = 0;
122
                action = 3;
123
                active = false;
124
                attack_timer = irandom_range(30, 60);
125
            }
126
        }
127
        else
128
        {
129
            rot_speed = 
scr_approach
scr_approach

function
scr_approach(arg0, arg1, arg2)
{ if (arg0 < arg1) { arg0 += arg2; if (arg0 > arg1) return arg1; } else { arg0 -= arg2; if (arg0 < arg1) return arg1; } return arg0; }
(rot_speed, 0, 4);
130
            y = 
scr_approach
scr_approach

function
scr_approach(arg0, arg1, arg2)
{ if (arg0 < arg1) { arg0 += arg2; if (arg0 > arg1) return arg1; } else { arg0 -= arg2; if (arg0 < arg1) return arg1; } return arg0; }
(y, obj_mike_controller.y + 100, 16);
131
        }
132
    }
133
}
134
if (phase == 1)
135
{
136
    timer += 1;
137
    if (hp <= 0)
138
    {
139
        timer = 0;
140
        active = false;
141
    }
142
    if (action == 0)
143
    {
144
        vspeed += 1;
145
        if (y > (cameray() + cameraheight()))
146
        {
147
            if (timer > 10)
148
            {
149
                y = cameray() - 120;
150
                x = camerax() + (camerawidth() / 2);
151
                vspeed = 0;
152
                timer = attack_timer;
153
                action = 1;
154
                hp = 5;
155
                with (obj_mike_bigcat)
156
                    happiness_speed = 0.25;
157
                xs = 0.75;
158
                with (obj_mike_attack_controller)
159
                    wave = 3;
160
            }
161
        }
162
        else
163
        {
164
            timer = 0;
165
        }
166
    }
167
    if (action == 1)
168
    {
169
        if (timer >= attack_timer)
170
        {
171
            action = 2;
172
            timer = spin_timer;
173
            with (obj_mike_attack_controller)
174
            {
175
                counter = other.timer;
176
                x = other.x;
177
            }
178
        }
179
    }
180
    if (action == 2)
181
    {
182
        rot_speed += spin_speed;
183
        timer -= 2;
184
        if (timer <= 0)
185
        {
186
            action = 3;
187
            timer = 0;
188
            active = true;
189
            sound_play(snd_screenshake);
190
        }
191
    }
192
    if (action == 3)
193
    {
194
        if (hp == 5)
195
            vspeed += 3;
196
        else
197
            vspeed += (5 + (5 - hp));
198
        if (y > (cameray() + cameraheight()))
199
        {
200
            if (timer > (hp * 8))
201
            {
202
                rot_speed = 4;
203
                playsound = 0;
204
                vspeed = 0;
205
                action = 1;
206
                attack_timer = 5 + (hp * 2);
207
                y = cameray() - 120;
208
                side += 1;
209
                if (side < 3)
210
                {
211
                    if (choose(1, 0))
212
                        x = camerax() + (camerawidth() / 2);
213
                    else
214
                        x = obj_mike_controller.x;
215
                }
216
                else
217
                {
218
                    side = 0;
219
                    x = camerax() + (camerawidth() / 2) + (lastside * 100);
220
                    lastside = -lastside;
221
                }
222
            }
223
        }
224
        else if (y > cameray())
225
        {
226
            repeat (3)
227
            {
228
                var a = 
scr_afterimage_cat
scr_afterimage_cat

function
scr_afterimage_cat()
{ afterimage = instance_create(x + irandom_range(-sprite_width / 2, sprite_width / 2), y, obj_afterimage); afterimage.sprite_index = spr_mike_cat_dance; afterimage.image_index = irandom(20); afterimage.image_blend = image_blend; afterimage.image_speed = 0; afterimage.depth = depth; afterimage.fadeSpeed = 0.08; return afterimage; }
();
229
                a.image_speed = 1;
230
                with (a)
231
                {
232
                    motion_add(point_direction(other.x, other.y, x, y), 2);
233
                    vspeed = -2;
234
                }
235
            }
236
            
scr_shakescreen
scr_shakescreen

function
scr_shakescreen(arg0 = 4, arg1 = 4)
{ var shaker = instance_create(x, y, obj_shake); if (i_ex(shaker)) { shaker.shakex = arg0; shaker.shakey = arg1; } }
();
237
        }
238
    }
239
}
240
if (phase == 2)
241
{
242
    if (action == 0)
243
    {
244
        timer += 1;
245
        if (timer > 90)
246
        {
247
            mus_volume(global.currentsong[1], 1, 100);
248
            shake = 0;
249
            with (obj_mike_attack_controller)
250
            {
251
                action = 16;
252
                wave = 0;
253
                timer = 0;
254
                mike = 3;
255
                txt_wait = 5;
256
                move_party = true;
257
            }
258
            with (obj_herokris)
259
                idlesprite = spr_krisb_idle;
260
            with (obj_herosusie)
261
            {
262
                idlesprite = spr_susieb_idle;
263
                if (global.charweapon[2] == 0)
264
                    idlesprite = spr_susieb_idle_unarmed;
265
            }
266
            with (obj_heroralsei)
267
            {
268
                y = ystart;
269
                state = 0;
270
                idlesprite = spr_ralsei_idle;
271
            }
272
            with (obj_heroparent)
273
                sprite_index = idlesprite;
274
            with (obj_mike_battle)
275
            {
276
                move = false;
277
                action = 0;
278
                visible = true;
279
                y = ystart;
280
            }
281
            instance_destroy();
282
        }
283
    }
284
}