Deltarune (Chapter 3) script viewer

← back to main script listing

gml_Object_obj_dw__backstagelight_Draw_0

(view raw script w/o annotations or w/e)
1
var lightcol = image_blend;
2
depth = 950000;
3
if (global.interact == 0 || premove == 0)
4
    timer += timerrate;
5
if (movetype == 1)
6
    y = (wally - mt1off) + (sin(timer / rate) * movespeed);
7
if (movetype == 2 && global.interact == 0)
8
{
9
    y += movespeed;
10
    if (y > 700)
11
        y -= 900;
12
}
13
if (movetype == 3)
14
{
15
    y = (wally - 60) + (sin(timer / rate) * movespeed);
16
    x = xstart + (sin(timer / rate / 2) * movespeed * 2);
17
}
18
if (movetype == 4)
19
{
20
    x = xstart - (sin(timer / amplitude) * xrange);
21
    y = ystart + (cos(timer / amplitude) * range);
22
}
23
var drawx = x;
24
var drawy = y;
25
if (type == 0)
26
{
27
    draw_sprite_ext(sprite_index, 0, drawx + (sin(timer / 10) * 4), drawy + (cos(timer / 23) * 1), image_xscale * 2, image_yscale, 0, lightcol, image_alpha * 0.5);
28
    draw_sprite_ext(sprite_index, 0, drawx + (sin(timer / 11) * 4), drawy, (image_xscale * 2) + 0.5, image_yscale + 0.2, 0, lightcol, image_alpha * 0.4);
29
}
30
if (type == 1)
31
{
32
    var wallStretchScale = 8;
33
    var normalStretchScale = 4;
34
    var fullHeight = sprite_height;
35
    var squashedTop = -1;
36
    var stretchedHeight = sprite_height;
37
    var squashedHeight = 1;
38
    stretchedHeight = min((wally - y) / wallStretchScale, sprite_height);
39
    var withinCollision = 0;
40
    var collisionx1 = x + 80;
41
    var collisionx2 = (x + (sprite_width * normalStretchScale)) - 80;
42
    var collisiony1 = wally - 40;
43
    var collisiony2 = wally + 40;
44
    var foundObject = -4;
45
    var caught = 0;
46
    if (global.interact == 0 && !alerted)
47
    {
48
        if (detecttype == 0)
49
        {
50
            if (y < wally && abs(y - wally) < 110)
51
            {
52
                foundObject = collision_rectangle(collisionx1, collisiony1, collisionx2, collisiony2, obj_mainchara, false, true);
53
                if (foundObject != -4)
54
                    caught = 1;
55
                draw_set_color(c_white);
56
                if (caught == 1)
57
                {
58
                    alerter = foundObject;
59
                    alerted = 1;
60
                }
61
            }
62
        }
63
        if (detecttype == 1)
64
        {
65
            withinCollision = 0;
66
            collisionx1 = x + 50;
67
            collisionx2 = (x + (sprite_width * normalStretchScale)) - 50;
68
            collisiony1 = bbox_top;
69
            collisiony2 = y + 30;
70
            foundObject = -4;
71
            caught = 0;
72
            foundObject = collision_rectangle(collisionx1, collisiony1, collisionx2, collisiony2, obj_mainchara, false, true);
73
            if (foundObject != -4)
74
                framecount++;
75
            else
76
                framecount = 0;
77
            if (framecount >= 2)
78
                caught = 1;
79
            if (caught == 1)
80
            {
81
                alerter = foundObject;
82
                alerted = 1;
83
            }
84
        }
85
        if (detecttype == 2)
86
        {
87
            collisionx1 = x + 84;
88
            collisionx2 = (x + (sprite_width * normalStretchScale)) - 84;
89
            collisiony1 = wally;
90
            collisiony2 = wally + 40;
91
            if (y < (wally + 10) && abs(y - wally) < 112)
92
            {
93
                foundObject = collision_rectangle(collisionx1, collisiony1, collisionx2, collisiony2, obj_mainchara, false, true);
94
                if (foundObject != -4)
95
                    framecount++;
96
                else
97
                    framecount = 0;
98
                if (framecount >= 2)
99
                    caught = 1;
100
                draw_set_color(c_white);
101
                if (caught == 1)
102
                {
103
                    alerter = foundObject;
104
                    alerted = 1;
105
                    snd_play(snd_error);
106
                }
107
            }
108
        }
109
    }
110
    if (givepoints == 0)
111
        lightcol = merge_color(lightcol, c_blue, 0.1);
112
    if (stretchedHeight > 0)
113
        draw_sprite_part_ext(sprite_index, 0, 0, 0, sprite_width, stretchedHeight, x, y, normalStretchScale, wallStretchScale, lightcol, image_alpha * 0.45);
114
    draw_sprite_part_ext(sprite_index, 0, 0, stretchedHeight, sprite_width, sprite_height - stretchedHeight, x, y + (stretchedHeight * wallStretchScale), normalStretchScale, normalStretchScale, lightcol, image_alpha * 0.6);
115
}
116
if (drawlamp)
117
{
118
    var modder = sin(timer / 10);
119
    if (type == 1)
120
        modder = 0;
121
    var xloc = x;
122
    if (type == 1)
123
        xloc = drawx + 60;
124
    var wirecolor = 659218;
125
    draw_sprite_ext(spr_pxwhite, 0, (xloc + (modder * 2)) - 2, (ystart + ((y - ystart) / 4)) - lightpos, 2, 40, -180, wirecolor, 1);
126
    draw_sprite_ext(spr_pxwhite, 0, xloc + (modder * 2) + 4, (ystart + ((y - ystart) / 4)) - lightpos, 2, 40, -180, wirecolor, 1);
127
    draw_sprite_ext(spr_pxwhite, 0, (xloc + (modder * 1.5)) - 2, (ystart + ((y - ystart) / 4)) - lightpos - 40, 2, 120, -180, wirecolor, 1);
128
    draw_sprite_ext(spr_pxwhite, 0, xloc + (modder * 1.5) + 4, (ystart + ((y - ystart) / 4)) - lightpos - 40, 2, 120, -180, wirecolor, 1);
129
    draw_sprite_ext(spr_b3bs_decor_spotlight, 0, xloc + (modder * 2), (ystart + ((y - ystart) / 4)) - lightpos, 2, 2, 0, c_white, 1);
130
}
131
premove = 1;