Deltarune (Chapter 5) script viewer

← back to main script listing

gml_Object_obj_blocktree_pink_bg_Step_0

(view raw script w/o annotations or w/e)
1
oo = 0;
2
if (spec < 2)
3
    blocktimer += 1;
4
shrink_current++;
5
if (growsound != -4)
6
{
7
    if (can_shrink && image_xscale == xscale_start && image_yscale == yscale_start)
8
    {
9
        snd_volume(growsound, 0, 1);
10
    }
11
    else if (can_shrink && shrink_current > shrinkdelay)
12
    {
13
        x = lerp(xstart, xstart - (sprite_get_width(sprite_index) * 0.5), image_xscale);
14
        y = lerp(ystart, ystart - (sprite_get_height(sprite_index) * 0.75), image_yscale);
15
        image_xscale = 
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; }
(image_xscale, xscale_start, 0.01);
16
        image_yscale = 
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; }
(image_yscale, yscale_start, 0.01);
17
        snd_pitch(growsound, image_xscale / 2);
18
        var target = 1198;
19
        if (!i_ex(target))
20
            target = 910;
21
        if (!i_ex(target))
22
            target = 1660;
23
        if (i_ex(target))
24
            snd_volume(growsound, 1 - inverselerp(0, 1000, point_distance(x, y, target.x, target.y)), 1);
25
    }
26
    else if (can_shrink && shrink_current >= 2)
27
    {
28
        snd_pitch(growsound, image_xscale / 2);
29
        snd_volume(growsound, 0, 1);
30
    }
31
}
32
blocktimer = 0;
33
if (blocktimer == 20)
34
{
35
    xv = x + (sprite_width / 4) + random(sprite_width / 2);
36
    yv = y + (sprite_height / 4) + random(sprite_height / 4);
37
    block = 
scr_dark_marker
scr_dark_marker

function
scr_dark_marker(arg0, arg1, arg2)
{ thismarker = instance_create(arg0, arg1, obj_marker); with (thismarker) { sprite_index = arg2; image_speed = 0; image_xscale = 2; image_yscale = 2; } return thismarker; }
(xv, yv, spr_blocktree_block_pink);
38
    with (block)
39
    {
40
        hspeed = (0.4 + random(1)) * (other.leaf_dir * -1);
41
        vspeed = 0.7 + random(1.5);
42
        gravity_direction = other.leaf_dir ? 180 : 0;
43
        gravity = 0.1;
44
        image_alpha = 0;
45
        friction = -0.1;
46
    }
47
    block.depth = depth - 1;
48
    block.image_blend = merge_color(c_white, c_black, oo);
49
    if (oo >= 0.8)
50
    {
51
        with (block)
52
            instance_destroy();
53
    }
54
}
55
if (blocktimer >= 20 && blocktimer <= 30)
56
{
57
    with (block)
58
    {
59
        if (image_alpha < 1)
60
            image_alpha += 0.2;
61
    }
62
}
63
if (blocktimer >= 38)
64
{
65
    with (block)
66
        image_alpha -= 0.1;
67
}
68
if (blocktimer >= 48)
69
{
70
    blocktimer = 0;
71
    with (block)
72
        instance_destroy();
73
}