Deltarune (Chapter 5) script viewer

← back to main script listing

gml_Object_obj_darkfruit_tree_plat_Step_2

(view raw script w/o annotations or w/e)
1
event_inherited();
2
if (global.pause_plat)
3
{
4
}
5
else if (!init)
6
{
7
    scr_plat_depthcast();
8
    init = true;
9
    if (scr_flag_get_ext(_ROOM_STATE_FLAG, _TREE_SMASHED_BIT, 1) && state == 0)
10
        wreck_tree();
11
}
12
for (var i = 0; i < array_length(fruits); i++)
13
{
14
    if (instance_exists(fruits[i]))
15
    {
16
        fruits[i].depth = other.depth - 1;
17
        fruits[i].x = x + (fruitoffsets[i][0] * image_xscale);
18
        fruits[i].y = y + (fruitoffsets[i][1] * image_yscale);
19
    }
20
}
21
if (instance_exists(branch))
22
{
23
    branch.x = x;
24
    branch.y = y;
25
    branch.depth = other.depth - 1;
26
}
27
if (global.pause_plat)
28
    exit;
29
if (state >= 1)
30
{
31
    timer++;
32
    if (state == 1)
33
    {
34
        scr_flag_set_ext(_ROOM_STATE_FLAG, _TREE_SMASHED_BIT, 1);
35
        if (timer == 1)
36
        {
37
            vspeed = -8;
38
            entity_gravity = 2;
39
            physics = true;
40
        }
41
        if (timer == 12)
42
        {
43
            vspeed = 0;
44
            physics = false;
45
            entity_gravity = 0;
46
            gravity = 0;
47
            state = 2;
48
            timer = 0;
49
        }
50
    }
51
    else if (state == 2)
52
    {
53
        if (timer <= 55)
54
            image_angle = sin(timer / 8) * (timer / 15);
55
        if (timer == 56)
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_angle", image_angle, image_angle - 35, 30, 3, "in");
57
        if (timer == 85)
58
        {
59
            state = 3;
60
            timer = 0;
61
        }
62
    }
63
    else if (state == 3 && timer == 1)
64
    {
65
        state = 0;
66
        
scr_shakeobj
scr_shakeobj

function
scr_shakeobj()
{ var _shakeobj = instance_create(x, y, obj_shakeobj); _shakeobj.target = id; if (argument_count >= 1) { if (i_ex(argument0)) _shakeobj.target = argument0; } if (argument_count >= 2) { if (argument1 != -1) _shakeobj.shakeamt = argument1; } if (argument_count >= 3) { if (argument2 != -1) _shakeobj.shakereduct = argument2; } with (_shakeobj) event_user(0); }
();
67
        hspeed = 0;
68
        vspeed = 0;
69
        slope = instance_create((x + 60) - (38 * image_xscale), (y - 320) + (164 * image_yscale), obj_plat_slope);
70
        slope.depth = -10;
71
        slope.visible = 0;
72
        slope.image_xscale = 1.6 * image_xscale;
73
        slope.image_yscale = 2.1 * image_yscale;
74
        with (slope)
75
        {
76
            set_slope();
77
            with (instance_create(x2, y2 + 4, obj_plat_floor))
78
            {
79
                visible = 0;
80
                depth = -10;
81
            }
82
        }
83
    }
84
}