Deltarune (Chapter 4) script viewer

← back to main script listing

gml_Object_obj_mike_minigame_controller_Other_20

(view raw script w/o annotations or w/e)
1
timer++;
2
if (wave == 0 && timer == 30)
3
{
4
    obj_mike_controller.type = 15;
5
    with (obj_mike_battle)
6
        move = true;
7
}
8
plueywater.x = camerax();
9
plueywater.y = cameray();
10
global.inv--;
11
has_shelter_on_left = wave == 1;
12
has_shelter_on_right = wave < 4;
13
if (wave == 0 && timer == 40)
14
{
15
    wave++;
16
    var xx = camerax() + (0.5 * camerawidth());
17
    var yy = cameray() + 300;
18
    var cat = instance_create(xx - 400, yy, obj_mike_grabcat_pluey);
19
    with (cat)
20
        walks = false;
21
    var shelter1 = instance_create(xx - 380, yy + 25, obj_marker);
22
    with (shelter1)
23
    {
24
        sprite_index = spr_mike_shelter;
25
        depth += 100;
26
        
scr_darksize
scr_darksize

function
scr_darksize()
{ var inst = id; if (argument_count) inst = argument0; inst.image_xscale = 2; inst.image_yscale = 2; }
();
27
        
scr_lerpvar
scr_lerpvar

function
scr_lerpvar()
{ if (argument_count < 6) ___lerpvar =
scr_lerpvar_instance(id, argument[0], argument[1], argument[2], argument[3]);
else ___lerpvar =
scr_lerpvar_instance(id, argument[0], argument[1], argument[2], argument[3], argument[4], argument[5]);
return ___lerpvar; } function scr_lerpvar_respect() { if (argument_count < 6) ___lerpvar =
scr_lerpvar_instance(id, argument[0], argument[1], argument[2], argument[3]);
else ___lerpvar =
scr_lerpvar_instance(id, argument[0], argument[1], argument[2], argument[3], argument[4], argument[5]);
___lerpvar.respectglobalinteract = true; return ___lerpvar; }
("x", x, x + 60, 60);
28
    }
29
    var shelter2 = instance_create(xx + 380, yy + 25, obj_marker);
30
    with (shelter2)
31
    {
32
        sprite_index = spr_mike_shelter;
33
        depth += 100;
34
        
scr_darksize
scr_darksize

function
scr_darksize()
{ var inst = id; if (argument_count) inst = argument0; inst.image_xscale = 2; inst.image_yscale = 2; }
();
35
        image_xscale *= -1;
36
        
scr_lerpvar
scr_lerpvar

function
scr_lerpvar()
{ if (argument_count < 6) ___lerpvar =
scr_lerpvar_instance(id, argument[0], argument[1], argument[2], argument[3]);
else ___lerpvar =
scr_lerpvar_instance(id, argument[0], argument[1], argument[2], argument[3], argument[4], argument[5]);
return ___lerpvar; } function scr_lerpvar_respect() { if (argument_count < 6) ___lerpvar =
scr_lerpvar_instance(id, argument[0], argument[1], argument[2], argument[3]);
else ___lerpvar =
scr_lerpvar_instance(id, argument[0], argument[1], argument[2], argument[3], argument[4], argument[5]);
___lerpvar.respectglobalinteract = true; return ___lerpvar; }
("x", x, x - 60, 60);
37
    }
38
    var basket = instance_create(xx + 380, yy, obj_mike_catbasket);
39
    with (basket)
40
    {
41
        
scr_lerpvar
scr_lerpvar

function
scr_lerpvar()
{ if (argument_count < 6) ___lerpvar =
scr_lerpvar_instance(id, argument[0], argument[1], argument[2], argument[3]);
else ___lerpvar =
scr_lerpvar_instance(id, argument[0], argument[1], argument[2], argument[3], argument[4], argument[5]);
return ___lerpvar; } function scr_lerpvar_respect() { if (argument_count < 6) ___lerpvar =
scr_lerpvar_instance(id, argument[0], argument[1], argument[2], argument[3]);
else ___lerpvar =
scr_lerpvar_instance(id, argument[0], argument[1], argument[2], argument[3], argument[4], argument[5]);
___lerpvar.respectglobalinteract = true; return ___lerpvar; }
("x", x, x - 120, 60);
42
        keepalive = true;
43
    }
44
}
45
if (wave == 1)
46
{
47
    if (myscore >= 50)
48
    {
49
        wave = 2;
50
    }
51
    else if (instance_number(obj_mike_grabcat_pluey) == 0)
52
    {
53
        var xx = camerax() + (0.5 * camerawidth());
54
        var yy = cameray() + 300;
55
        var cat = instance_create(xx - 400, yy, obj_mike_grabcat_pluey);
56
        with (cat)
57
        {
58
            walks = false;
59
            max_vspeed = lerp(6, 12, clamp01((other.myscore - 150) / 500));
60
        }
61
    }
62
}
63
else if (wave == 2)
64
{
65
    with (obj_marker)
66
    {
67
        if (sprite_index == spr_mike_shelter && x < (camerax() + 320))
68
        {
69
            
scr_lerpvar
scr_lerpvar

function
scr_lerpvar()
{ if (argument_count < 6) ___lerpvar =
scr_lerpvar_instance(id, argument[0], argument[1], argument[2], argument[3]);
else ___lerpvar =
scr_lerpvar_instance(id, argument[0], argument[1], argument[2], argument[3], argument[4], argument[5]);
return ___lerpvar; } function scr_lerpvar_respect() { if (argument_count < 6) ___lerpvar =
scr_lerpvar_instance(id, argument[0], argument[1], argument[2], argument[3]);
else ___lerpvar =
scr_lerpvar_instance(id, argument[0], argument[1], argument[2], argument[3], argument[4], argument[5]);
___lerpvar.respectglobalinteract = true; return ___lerpvar; }
("x", x, x - 300, 60);
70
            
scr_doom
scr_doom

function
scr_doom(arg0 = id, arg1)
{ with (instance_create_depth(0, 0, 0, obj_doom)) { alarm[0] target = arg0; persistent = arg0.persistent; } }
(self, 60);
71
        }
72
    }
73
    wave = 3;
74
}
75
else if (wave == 3)
76
{
77
    if (myscore >= 500)
78
        wave = 4;
79
}
80
else if (wave == 4)
81
{
82
    with (obj_marker)
83
    {
84
        if (sprite_index == spr_mike_shelter && x > (camerax() + 320))
85
        {
86
            
scr_lerpvar
scr_lerpvar

function
scr_lerpvar()
{ if (argument_count < 6) ___lerpvar =
scr_lerpvar_instance(id, argument[0], argument[1], argument[2], argument[3]);
else ___lerpvar =
scr_lerpvar_instance(id, argument[0], argument[1], argument[2], argument[3], argument[4], argument[5]);
return ___lerpvar; } function scr_lerpvar_respect() { if (argument_count < 6) ___lerpvar =
scr_lerpvar_instance(id, argument[0], argument[1], argument[2], argument[3]);
else ___lerpvar =
scr_lerpvar_instance(id, argument[0], argument[1], argument[2], argument[3], argument[4], argument[5]);
___lerpvar.respectglobalinteract = true; return ___lerpvar; }
("x", x, x + 300, 60);
87
            
scr_doom
scr_doom

function
scr_doom(arg0 = id, arg1)
{ with (instance_create_depth(0, 0, 0, obj_doom)) { alarm[0] target = arg0; persistent = arg0.persistent; } }
(self, 60);
88
        }
89
    }
90
    wave = 5;
91
}
92
var minvalue = max(8 - floor(myscore / 150), 4);
93
var spawn_rain = (timer % max(31 - (2 * floor(myscore / 10)), minvalue)) == 0;
94
if (shelter_has_time_limit)
95
{
96
    if (myscore < 200)
97
        shelter_current_time -= lerp(1, 3, myscore / 200);
98
    else if (myscore / 500)
99
        shelter_current_time -= lerp(3, 5.5, (myscore - 200) / 300);
100
    else
101
        shelter_current_time -= lerp(5.5, 7.5, (myscore - 500) / 1000);
102
    if (shelter_current_time_eased <= -20)
103
    {
104
        minvalue = 2;
105
        spawn_rain = (timer % max(16 - (2 * floor(myscore / 10)), minvalue)) == 0;
106
    }
107
}
108
if (shelter_has_time_limit)
109
    shelter_current_time_eased = lerp(shelter_current_time_eased, shelter_current_time, 0.02);
110
if (wave >= 1 && myscore > 0)
111
{
112
    if (spawn_rain)
113
    {
114
        if (wave >= 3)
115
        {
116
            var maxcats = 2;
117
            if (wave == 5)
118
                maxcats = 3;
119
            var xx = camerax() + (0.5 * camerawidth());
120
            var xxx = random_range(xx - 320, xx + 280);
121
            var cats = 0;
122
            with (obj_mike_grabcat_pluey)
123
            {
124
                if (action != 1)
125
                    cats++;
126
            }
127
            if (cats < maxcats && random_range(0, 1) > (0.5 - (0.1 * tracker)) && xxx < xx)
128
            {
129
                var rain = instance_create(xxx, cameray() - 40, obj_mike_grabcat_pluey);
130
                rain.israin = true;
131
                rain.vspeed = 3;
132
                tracker = 0;
133
            }
134
            else
135
            {
136
                tracker++;
137
                var rain = instance_create(xxx, cameray() - 40, obj_mike_raindrop);
138
                rain.vspeed = 3;
139
                with (rain)
140
                    
scr_darksize
scr_darksize

function
scr_darksize()
{ var inst = id; if (argument_count) inst = argument0; inst.image_xscale = 2; inst.image_yscale = 2; }
();
141
                if (shelter_current_time_eased < -20 && random_range(0, 1) < 0.2)
142
                {
143
                    with (rain)
144
                    {
145
                        
scr_lerpvar
scr_lerpvar

function
scr_lerpvar()
{ if (argument_count < 6) ___lerpvar =
scr_lerpvar_instance(id, argument[0], argument[1], argument[2], argument[3]);
else ___lerpvar =
scr_lerpvar_instance(id, argument[0], argument[1], argument[2], argument[3], argument[4], argument[5]);
return ___lerpvar; } function scr_lerpvar_respect() { if (argument_count < 6) ___lerpvar =
scr_lerpvar_instance(id, argument[0], argument[1], argument[2], argument[3]);
else ___lerpvar =
scr_lerpvar_instance(id, argument[0], argument[1], argument[2], argument[3], argument[4], argument[5]);
___lerpvar.respectglobalinteract = true; return ___lerpvar; }
("y", y, 40, 10);
146
                        event_user(1);
147
                    }
148
                }
149
            }
150
        }
151
        else
152
        {
153
            var xx = camerax() + (0.5 * camerawidth());
154
            var rain = instance_create(random_range(xx - 280, xx + 280), cameray() - 40, obj_mike_raindrop);
155
            rain.vspeed = 3;
156
            with (rain)
157
                
scr_darksize
scr_darksize

function
scr_darksize()
{ var inst = id; if (argument_count) inst = argument0; inst.image_xscale = 2; inst.image_yscale = 2; }
();
158
            if (shelter_current_time_eased < -20 && random_range(0, 1) < 0.2)
159
            {
160
                with (rain)
161
                {
162
                    
scr_lerpvar
scr_lerpvar

function
scr_lerpvar()
{ if (argument_count < 6) ___lerpvar =
scr_lerpvar_instance(id, argument[0], argument[1], argument[2], argument[3]);
else ___lerpvar =
scr_lerpvar_instance(id, argument[0], argument[1], argument[2], argument[3], argument[4], argument[5]);
return ___lerpvar; } function scr_lerpvar_respect() { if (argument_count < 6) ___lerpvar =
scr_lerpvar_instance(id, argument[0], argument[1], argument[2], argument[3]);
else ___lerpvar =
scr_lerpvar_instance(id, argument[0], argument[1], argument[2], argument[3], argument[4], argument[5]);
___lerpvar.respectglobalinteract = true; return ___lerpvar; }
("y", y, 40, 10);
163
                    event_user(1);
164
                }
165
            }
166
        }
167
    }
168
}
169
if (cats_bonus_timer > 0)
170
    cats_bonus_timer--;
171
if (instance_exists(obj_mike_catbasket))
172
{
173
    with (obj_mike_catbasket)
174
        image_blend = merge_color(c_white, c_yellow, min(1, other.cats_bonus_timer / 20));
175
    if (cats_deposited < obj_mike_catbasket.cats)
176
    {
177
        shelter_current_time = shelter_time_limit;
178
        shelter_has_time_limit = true;
179
        var diff = obj_mike_catbasket.cats - cats_deposited;
180
        for (var i = 0; i < diff; i++)
181
        {
182
            var add = 10;
183
            if (cats_bonus_timer > 0)
184
            {
185
                pluey_combo_chain = min(pluey_combo_chain + 1, 5);
186
                add = 15 + (pluey_combo_chain * 5);
187
                with (obj_mike_catbasket)
188
                    scoreflash = 1.3;
189
                snd_play(snd_sparkle_glock, 1, 1 - ((pluey_combo_chain - 1) * 0.05));
190
                instance_create_depth(obj_mike_catbasket.x - 36, obj_mike_catbasket.y - 40, depth, obj_minigame_score);
191
            }
192
            else
193
            {
194
                pluey_combo_chain = 0;
195
            }
196
            myscore += add;
197
            if (obj_mike_catbasket.last_cat_was_thrown)
198
                cats_bonus_timer = 70;
199
            else
200
                cats_bonus_timer = 100;
201
            if (myscore < 50)
202
                cats_bonus_timer += 30;
203
        }
204
        cats_deposited = obj_mike_catbasket.cats;
205
    }
206
}