Deltarune (Chapter 2) script viewer

← back to main script listing

gml_Object_obj_swatchling_platter_Step_0

(view raw script w/o annotations or w/e)
1
if (init == 0)
2
{
3
    scr_bullet_inherit
scr_bullet_inherit

function scr_bullet_inherit(arg0) { if (i_ex(arg0)) { if (damage != -1) arg0.damage = damage; if (grazepoints != -1) arg0.grazepoints = grazepoints; if (timepoints != -1) arg0.timepoints = timepoints; if (inv != -1) arg0.inv = inv; if (target != -1) arg0.target = target; if (grazed != -1) arg0.grazed = 0; if (grazetimer != -1) arg0.grazetimer = 0; arg0.element = element; } }
(platterLid);
4
    scr_bullet_inherit
scr_bullet_inherit

function scr_bullet_inherit(arg0) { if (i_ex(arg0)) { if (damage != -1) arg0.damage = damage; if (grazepoints != -1) arg0.grazepoints = grazepoints; if (timepoints != -1) arg0.timepoints = timepoints; if (inv != -1) arg0.inv = inv; if (target != -1) arg0.target = target; if (grazed != -1) arg0.grazed = 0; if (grazetimer != -1) arg0.grazetimer = 0; arg0.element = element; } }
(platterPlate);
5
    targetColor = startColor;
6
    platterPlate.image_blend = startColor;
7
    platterLid.image_blend = startColor;
8
    platterPlate.image_angle = image_angle;
9
    platterLid.image_angle = image_angle;
10
    if (image_angle > 0)
11
        platterLid.image_xscale *= -1;
12
    init = 1;
13
}
14
if (hasCandy == 1)
15
{
16
    d = instance_create(x + (20 * -side), y, obj_swatchling_candy);
17
    d.sourcePlatter = self;
18
    d.target = target;
19
    d.side = side;
20
    hasCandy = -1;
21
}
22
if (!lidOff)
23
{
24
    if (timer >= 0)
25
    {
26
        if (!opened)
27
        {
28
            if (firstOpen)
29
                firstOpen = false;
30
            opened = true;
31
            birdfork = birds > 1;
32
            var offbird = 1;
33
            if (hasCandy == -1)
34
                birds--;
35
            if (birds > 2 || hasCandy == -1)
36
                offbird = irandom(birds - 1);
37
            for (i = 0; i < birds; i++)
38
            {
39
                var _bird_index = swatchbc.bird_count - 1 - i;
40
                if (_bird_index < 0)
41
                    break;
42
                var yy = y + 10;
43
                if (birdfork)
44
                {
45
                    if (i == 0)
46
                        y -= 10;
47
                    else
48
                        y += 10;
49
                }
50
                d = instance_create(x + (20 * -side), yy, obj_swatchling_bird);
51
                if (side == 1)
52
                    d.image_xscale *= -1;
53
                d.platter_spawn = true;
54
                d.image_blend = swatchbc.bird_color[i];
55
                d.damage = swatchbc.red_damage[i];
56
                d.target = swatchbc.red_target[i];
57
                d.grazepoints = 4;
58
                if (i == offbird)
59
                    d.fixed_angle = true;
60
            }
61
            birds = 0;
62
        }
63
        lidLerp = 1 - (abs(timer - 20) / 20);
64
        lidOffset = -1 * lidLerp * (lidLerp - 2);
65
        if (firstOpen)
66
            lidOffset = min(lidOffset, 0);
67
        platterPlate.x = x + (lidOffset * 10 * side);
68
        platterLid.x = x - (lidOffset * 60 * side);
69
    }
70
    else if (timer < -10 && opened)
71
    {
72
        lidLerp = 1 - (abs(timer + 15) / 5);
73
        lidOffset = -1 * lidLerp * (lidLerp - 2);
74
        platterPlate.x = x + (lidOffset * 20 * side);
75
        platterLid.x = x + (lidOffset * 20 * side);
76
    }
77
    else
78
    {
79
        platterPlate.x = x;
80
        platterLid.x = x;
81
    }
82
}
83
platterPlate.y = y;
84
platterLid.y = y;
85
if (timer >= 40)
86
    timer = -20;
87
else
88
    timer++;