Deltarune (Chapter 5) script viewer

← back to main script listing

gml_Object_obj_blue_platform_Step_0

(view raw script w/o annotations or w/e)
1
if (!visible)
2
{
3
    if (!global.pause_plat)
4
        sinertimer++;
5
    if (!wants_respawn)
6
    {
7
        with (obj_plat_player)
8
        {
9
            if ((fallen_in_pit && x < other.x) || (scr_trigcheck_ext("start_reset", self) && x < (other.x - 400)))
10
                other.wants_respawn = true;
11
        }
12
    }
13
    else
14
    {
15
        with (obj_plat_player)
16
        {
17
            if (grounded)
18
                other.restore_cloud();
19
        }
20
    }
21
    exit;
22
}
23
if (init == 0)
24
{
25
    init = true;
26
    if (has_flower)
27
    {
28
        flower = instance_create(x, y, obj_plat_blueflower);
29
        with (flower)
30
            
scr_darksize
scr_darksize

function
scr_darksize()
{ var inst = id; if (argument_count) inst = argument0; inst.image_xscale = 2; inst.image_yscale = 2; }
();
31
        flower.has_coin = false;
32
    }
33
}
34
if (!global.pause_plat)
35
    sinertimer++;
36
with (obj_plat_player)
37
{
38
    if (grounded && ground == other.platform)
39
    {
40
        if (!other.landed)
41
        {
42
            other.landed = true;
43
            other.was_touched = true;
44
            repeat (6)
45
            {
46
                var d = other.depth;
47
                var xx = x + random_range(-20, 20);
48
                with (instance_create(xx, other.y, obj_animation))
49
                {
50
                    sprite_index = spr_bhero_dust;
51
                    image_speed = 0.1;
52
                    image_blend = #40A0FF;
53
                    image_xscale = random_range(1, 2);
54
                    image_yscale = image_xscale;
55
                    
scr_lerpvar
scr_lerpvar

function
scr_lerpvar()
{ var _id = self; if (!is_struct(self)) _id = id; 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_lerpcol() { if (argument_count < 6) ___lerpvar = scr_lerpcol_instance(id, argument[0], argument[1], argument[2], argument[3]); else ___lerpvar = scr_lerpcol_instance(id, argument[0], argument[1], argument[2], argument[3], argument[4], argument[5]); return ___lerpvar; }
("image_yscale", image_yscale, 0, 30);
56
                    
scr_lerpvar
scr_lerpvar

function
scr_lerpvar()
{ var _id = self; if (!is_struct(self)) _id = id; 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_lerpcol() { if (argument_count < 6) ___lerpvar = scr_lerpcol_instance(id, argument[0], argument[1], argument[2], argument[3]); else ___lerpvar = scr_lerpcol_instance(id, argument[0], argument[1], argument[2], argument[3], argument[4], argument[5]); return ___lerpvar; }
("image_xscale", image_xscale, 0, 30);
57
                    depth = d + 10;
58
                    vspeed = random_range(-4, -12);
59
                    friction = 0.5;
60
                    hspeed = random_range(-4, 4);
61
                }
62
            }
63
        }
64
    }
65
    else if (other.landed)
66
    {
67
        other.landed = false;
68
    }
69
}
70
if (landed || custom_landed)
71
{
72
    squishtimer = 
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; }
(squishtimer, 1, 0.2);
73
}
74
else if (squishtimer > 0)
75
{
76
    squishtimer = 
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; }
(squishtimer, 4, 0.2);
77
    if (squishtimer == 4)
78
        squishtimer = 0;
79
}
80
if (!is_being_shot && place_meeting(x, y, obj_plat_bulletred_laser) && !scr_trigcheck_ext("guntrigger", 910))
81
{
82
    is_being_shot = 1;
83
    explodetimer = 1;
84
    stop_sound();
85
}
86
if (!is_being_shot && has_flower)
87
{
88
    if (!instance_exists(flower))
89
        get_shot();
90
    with (flower)
91
    {
92
        if (con != 0)
93
        {
94
            with (other)
95
                get_shot();
96
        }
97
    }
98
}
99
if (has_flower && instance_exists(flower))
100
{
101
    flower.x = x;
102
    flower.y = bbox_top + 2;
103
}
104
if (movepattern == 0)
105
{
106
    x += h_amp;
107
    y_anchor += v_amp;
108
}
109
if (movepattern == 1)
110
{
111
    x += h_amp;
112
    y_anchor = ystart + (v_amp * sin(v_offset + (v_freq * sinertimer * 0.05)));
113
}
114
if (movepattern == 2)
115
{
116
    y_anchor += v_amp;
117
    x = xstart + (h_amp * sin(h_offset + (h_freq * sinertimer * 0.05)));
118
}
119
if (movepattern == 3)
120
{
121
    x = xstart + (h_amp * sin(h_offset + (h_freq * sinertimer * 0.05)));
122
    y_anchor = ystart + (v_amp * cos(v_offset + (v_freq * sinertimer * 0.05)));
123
}
124
y = y_anchor + (sin((sinertimer + siner_timer_offset) * 0.1) * 4);
125
if (has_active_plat)
126
{
127
    var xx = platform.x;
128
    var yy = platform.y;
129
    platform.image_angle = image_angle;
130
    platform.x = (x - lengthdir_x(0.5 * sprite_width, image_angle)) + lengthdir_y(0.5 * sprite_height, image_angle);
131
    platform.y = bbox_top + 2;
132
    platform.dif_x = platform.x - xx;
133
    platform.dif_y = platform.y - yy;
134
}
135
if (active_timer > 0)
136
{
137
    active_timer--;
138
}
139
else if (active_timer == 0 && !has_active_plat)
140
{
141
    platform = instance_create(x - (40 * image_xscale), y - (20 * image_xscale), obj_plat_floor);
142
    platform.image_xscale = image_xscale;
143
    if (sprite_index == spr_blue_platform_long)
144
        platform.image_xscale *= 3;
145
    if (sprite_index == spr_blue_platform_long_invcolor)
146
        platform.image_xscale *= 3;
147
    platform.visible = false;
148
    active_timer = -1;
149
    has_active_plat = true;
150
}
151
if (explodetimer > 0 && !global.pause_plat)
152
{
153
    explodetimer--;
154
    if (chargesound != -4)
155
    {
156
        snd_volume(chargesound, lerp(0.1, 0.7, (25 - (explodetimer - 5)) / 25), 0);
157
        snd_pitch(chargesound, lerp(0.5, 1, (25 - (explodetimer - 5)) / 25));
158
    }
159
    if (explodetimer == 0)
160
    {
161
        snd_play(snd_paperbreak);
162
        snd_play(snd_enemy_defeat_quick);
163
        var _y = (bbox_bottom + bbox_top) / 2;
164
        with (instance_create_depth(x, y, depth, obj_plat_vfx))
165
        {
166
            sprite_index = spr_smokepuff;
167
            image_blend = #40A0FF;
168
            image_speed = 0.5;
169
        }
170
        with (instance_create_depth(x, y, depth + 1, obj_plat_vfx))
171
        {
172
            sprite_index = spr_smokepuff;
173
            image_blend = c_blue;
174
            image_speed = 0.5;
175
            image_xscale *= 1.2;
176
            image_yscale *= 1.2;
177
        }
178
        var ang = 0;
179
        repeat (16)
180
        {
181
            ang += 22.5;
182
            var d = other.depth;
183
            with (instance_create(x, y, obj_animation))
184
            {
185
                sprite_index = spr_bhero_dust;
186
                image_speed = random_range(0.05, 0.12);
187
                image_blend = choose(c_blue, #40A0FF);
188
                image_xscale = random_range(1, 2);
189
                image_yscale = image_xscale;
190
                
scr_lerpvar
scr_lerpvar

function
scr_lerpvar()
{ var _id = self; if (!is_struct(self)) _id = id; 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_lerpcol() { if (argument_count < 6) ___lerpvar = scr_lerpcol_instance(id, argument[0], argument[1], argument[2], argument[3]); else ___lerpvar = scr_lerpcol_instance(id, argument[0], argument[1], argument[2], argument[3], argument[4], argument[5]); return ___lerpvar; }
("image_yscale", image_yscale, 0, 30);
191
                
scr_lerpvar
scr_lerpvar

function
scr_lerpvar()
{ var _id = self; if (!is_struct(self)) _id = id; 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_lerpcol() { if (argument_count < 6) ___lerpvar = scr_lerpcol_instance(id, argument[0], argument[1], argument[2], argument[3]); else ___lerpvar = scr_lerpcol_instance(id, argument[0], argument[1], argument[2], argument[3], argument[4], argument[5]); return ___lerpvar; }
("image_xscale", image_xscale, 0, 30);
192
                depth = d + 10;
193
                friction = 0.5;
194
                direction = ang;
195
                speed = random_range(5, 12);
196
            }
197
        }
198
        is_being_shot = false;
199
        active_timer = 60;
200
        explodetimer = 0;
201
        has_active_plat = false;
202
        destroy_platform();
203
    }
204
}