Deltarune (Chapter 3) script viewer

← back to main script listing

gml_Object_obj_dw_teevie_stealth_chaselamp_Step_0

(view raw script w/o annotations or w/e)
1
var trigd = false;
2
with (obj_dw_teevie_cameras)
3
{
4
    if (glitz_active)
5
        trigd = 1;
6
}
7
with (obj_dw_teevie_cameras_cheer)
8
{
9
    if (active)
10
        trigd = 1;
11
}
12
if (room == room_dw_teevie_lightmaze)
13
{
14
    trigd = 0;
15
    if (manualtrigger)
16
        trigd = 1;
17
}
18
if (init == 0)
19
{
20
    xstart = x;
21
    ystart = y;
22
    init = 1;
23
}
24
var lightcolactive = 65535;
25
var lightcolinactive = 9801727;
26
var homedist = point_distance(x, y, xstart, ystart);
27
var cancatch = false;
28
if (global.interact == 0)
29
    siner++;
30
if (con == 0)
31
{
32
    image_blend = lightcolactive;
33
    var tolerance = -80;
34
    if (!((x > (camerax() + tolerance) && x < ((camerax() + 640) - tolerance)) && (y > (cameray() + tolerance) && y < ((cameray() + 480) - tolerance))))
35
        trigd = 0;
36
    if (homedist > 40)
37
        trigd = 0;
38
    if (trigd == 1)
39
    {
40
        awaretime++;
41
        if (awaretime >= 2)
42
        {
43
            timer = 0;
44
            alert = 60;
45
            con = 1;
46
            awaretime = 0;
47
        }
48
    }
49
    else
50
    {
51
        awaretime = 0;
52
    }
53
    gohome--;
54
    if (gohome <= 0)
55
    {
56
        x = lerp(x, xstart, 0.1);
57
        y = lerp(y, ystart, 0.1);
58
    }
59
    if (point_distance(x, y, xstart, ystart) < 8)
60
        cancatch = true;
61
}
62
if (con == 1)
63
{
64
    if (!trigd || homedist > 600)
65
    {
66
        alert--;
67
    }
68
    else
69
    {
70
        cancatch = true;
71
        friction = 0;
72
        alert = 1;
73
        if (i_ex(obj_mainchara))
74
        {
75
            var memx = x;
76
            var memy = y;
77
            var memspeed = myspeed;
78
            var dist = point_distance(x, y, obj_mainchara.x + 18, obj_mainchara.y + 72);
79
            move_towards_point(obj_mainchara.x + 18, obj_mainchara.y + 72, min(speed, dist));
80
            var speedacctype = 0;
81
            if (room == room_dw_teevie_lightmaze)
82
                speedacctype = 1;
83
            if (speedacctype == 0)
84
                myspeed = lerp(myspeed, 12, 0.25);
85
            if (speedacctype == 1)
86
                myspeed = lerp(myspeed, 16, 0.04);
87
            if (global.interact == 0)
88
            {
89
                speed = myspeed;
90
            }
91
            else
92
            {
93
                x = memx;
94
                y = memy;
95
                myspeed = memspeed;
96
                speed = 0;
97
            }
98
            if (speed > dist)
99
                speed = dist;
100
        }
101
    }
102
    if (alert <= 0)
103
    {
104
        speed = 0;
105
        alert = 0;
106
        timer = 0;
107
        con = 0;
108
        gohome = 1;
109
    }
110
}
111
if (cancatch)
112
{
113
    if (global.interact == 0)
114
    {
115
        if (i_ex(collision_rectangle(x - 15, y - 10, x + 15, y + 10, obj_mainchara, 0, 0)))
116
        {
117
            global.interact = 1;
118
            con = 2;
119
            speed = 0;
120
            myspeed = 0;
121
            timer = 0;
122
            debug_print("caught");
123
        }
124
    }
125
}
126
if (con == 2)
127
{
128
    image_blend = lightcolactive;
129
    timer++;
130
    if (timer == 1)
131
    {
132
        snd_play(snd_bluh);
133
        
scr_lerpvar
scr_lerpvar

function
scr_lerpvar()
{ 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_lerpvar_respect() { 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]);
___lerpvar.respectglobalinteract = true; return ___lerpvar; }
("x", x, obj_mainchara.x + 18, 6, 2, "out");
134
        
scr_lerpvar
scr_lerpvar

function
scr_lerpvar()
{ 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_lerpvar_respect() { 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]);
___lerpvar.respectglobalinteract = true; return ___lerpvar; }
("y", y, obj_mainchara.y + 72, 6, 2, "out");
135
    }
136
    if (timer == 6)
137
        caught = true;
138
}