Deltarune (Chapter 3) script viewer

← back to main script listing

gml_Object_obj_b3bs_searchzapper_Step_0

(view raw script w/o annotations or w/e)
1
switch (state)
2
{
3
    case 0:
4
        
scr_depth
scr_depth

function
scr_depth()
{ if (argument_count > 0) { with (argument0) depth = 100000 - ((y * 10) + (sprite_height * 10)); } else { depth = 100000 - ((y * 10) + (sprite_height * 10)); } }
();
5
        if (pacetype == 0 && global.interact == 0)
6
        {
7
            if (con == 0)
8
            {
9
                dir = 1;
10
                image_index = dir;
11
                x += 4;
12
                if (x >= (xstart + 240))
13
                {
14
                    x = xstart + 240;
15
                    con = 1;
16
                    timer = 0;
17
                }
18
            }
19
            if (con == 1 || con == 3)
20
            {
21
                timer++;
22
                if (timer == 30 || timer == 90)
23
                {
24
                    dir = 2;
25
                    image_index = dir;
26
                }
27
                if (timer == 60 || timer == 1)
28
                {
29
                    dir = 0;
30
                    image_index = dir;
31
                }
32
                if (timer == 120)
33
                {
34
                    timer = 0;
35
                    if (con == 1)
36
                        con = 2;
37
                    if (con == 3)
38
                        con = 0;
39
                }
40
            }
41
            if (con == 2)
42
            {
43
                dir = 3;
44
                image_index = dir;
45
                x -= 4;
46
                if (x <= xstart)
47
                {
48
                    x = xstart;
49
                    con = 3;
50
                    timer = 0;
51
                }
52
            }
53
        }
54
        if (pacetype == 1 && global.interact == 0)
55
        {
56
            if (con == 0)
57
            {
58
                dir = 1;
59
                image_index = dir;
60
                x += 4;
61
                if (x >= (xstart + 280))
62
                {
63
                    x = xstart + 280;
64
                    con = 1;
65
                    timer = 0;
66
                }
67
            }
68
            if (con == 1 || con == 3 || con == 5 || con == 7)
69
            {
70
                timer++;
71
                if (timer == 30 || timer == 90)
72
                {
73
                    dir = 2;
74
                    image_index = dir;
75
                }
76
                if (timer == 60 || timer == 1)
77
                {
78
                    dir = 0;
79
                    image_index = dir;
80
                }
81
                if (timer == 120)
82
                {
83
                    timer = 0;
84
                    if (con == 1)
85
                        con = 2;
86
                    if (con == 3)
87
                        con = 4;
88
                    if (con == 5)
89
                        con = 6;
90
                    if (con == 7)
91
                        con = 0;
92
                }
93
            }
94
            if (con == 2)
95
            {
96
                dir = 1;
97
                image_index = dir;
98
                x += 4;
99
                if (x >= (xstart + 560))
100
                {
101
                    x = xstart + 560;
102
                    con = 3;
103
                    timer = 0;
104
                }
105
            }
106
            if (con == 4)
107
            {
108
                dir = 3;
109
                image_index = dir;
110
                x -= 4;
111
                if (x <= (xstart + 280))
112
                {
113
                    x = xstart + 280;
114
                    con = 5;
115
                    timer = 0;
116
                }
117
            }
118
            if (con == 6)
119
            {
120
                dir = 3;
121
                image_index = dir;
122
                x -= 4;
123
                if (x <= xstart)
124
                {
125
                    x = xstart;
126
                    con = 7;
127
                    timer = 0;
128
                }
129
            }
130
        }
131
        var trig = 0;
132
        with (sarea)
133
        {
134
            if (place_meeting(x, y, obj_mainchara))
135
                trig = 1;
136
            if (trig == 1)
137
            {
138
                with (obj_mainchara)
139
                {
140
                    if (place_meeting(x, y, obj_b3bs_stealthsafe))
141
                        trig = 0;
142
                }
143
            }
144
        }
145
        if (trig == 1)
146
        {
147
            debug_print("CAUGHT!!!!");
148
            state = 1;
149
            with (instance_create(x - 4, y + 116, obj_chaseenemy_zapper))
150
            {
151
            }
152
            safe_delete(sarea);
153
            instance_destroy();
154
        }
155
        break;
156
    case 1:
157
        timer++;
158
        if (timer == 1)
159
        {
160
            visible = false;
161
            state = 2;
162
        }
163
        break;
164
    case 2:
165
        break;
166
    case 3:
167
        break;
168
}