Deltarune (Chapter 1) script viewer

← back to main script listing

gml_Object_obj_growtangle_bouncer_Step_2

(view raw script w/o annotations or w/e)
1
if (type == 0)
2
{
3
    if (con == 0)
4
    {
5
        ux += 30;
6
        dx -= 30;
7
        lx += 30;
8
        rx -= 30;
9
        con = 0.4;
10
    }
11
    if (con == 0.4)
12
    {
13
        minitimer += 1;
14
        if (minitimer >= 14)
15
            con = 0.5;
16
    }
17
    if (con == 0.5 && speed < 4.6)
18
        speed += 0.2;
19
    if (con == 0.5 && speed >= 4.6)
20
    {
21
        timer += 1;
22
        if (timer >= 170)
23
            con = 1;
24
    }
25
    if (con == 1)
26
    {
27
        speed -= 0.2;
28
        if (speed <= 0.1)
29
            event_user(2);
30
    }
31
}
32
if (type == 1)
33
{
34
    if (con == 0)
35
    {
36
        direction += (random(20) - random(20));
37
        con = 0.5;
38
    }
39
    if (con == 0.5 && speed < 5.2)
40
        speed += 0.2;
41
    if (hspeed >= 4.2)
42
    {
43
        if (vspeed > 0)
44
        {
45
            vspeed += 0.1;
46
            hspeed -= 0.1;
47
        }
48
        else
49
        {
50
            vspeed -= 0.1;
51
            hspeed -= 0.1;
52
        }
53
    }
54
    if (hspeed <= -4.2)
55
    {
56
        if (vspeed > 0)
57
        {
58
            vspeed += 0.1;
59
            hspeed += 0.1;
60
        }
61
        else
62
        {
63
            vspeed -= 0.1;
64
            hspeed += 0.1;
65
        }
66
    }
67
    if (vspeed >= 4.2)
68
    {
69
        if (hspeed > 0)
70
        {
71
            hspeed += 0.1;
72
            vspeed -= 0.1;
73
        }
74
        else
75
        {
76
            hspeed -= 0.1;
77
            vspeed -= 0.1;
78
        }
79
    }
80
    if (vspeed <= -4.2)
81
    {
82
        if (hspeed > 0)
83
        {
84
            hspeed += 0.1;
85
            vspeed += 0.1;
86
        }
87
        else
88
        {
89
            hspeed -= 0.1;
90
            vspeed += 0.1;
91
        }
92
    }
93
    if (con == 0.5 && speed >= 5.2)
94
    {
95
        timer += 1;
96
        if (timer >= 90)
97
            con = 1;
98
    }
99
    if (con == 1)
100
    {
101
        speed -= 0.4;
102
        if (speed <= 0.1)
103
            event_user(2);
104
    }
105
}
106
if (type == 2)
107
{
108
    if (con == 0)
109
    {
110
        direction += (random(20) - random(20));
111
        con = 0.5;
112
        ux += 50;
113
        dx -= 50;
114
        lx += 50;
115
        rx -= 50;
116
    }
117
    if (con == 0.5 && speed < 5.2)
118
        speed += 0.2;
119
    if (con == 0.5 && speed >= 5.2)
120
    {
121
        timer += 1;
122
        if (timer >= 70)
123
            con = 1;
124
    }
125
    if (con == 1)
126
    {
127
        speed -= 0.5;
128
        if (speed <= 0.1)
129
            event_user(2);
130
    }
131
}
132
if (type == 3)
133
{
134
    if (con == 0)
135
    {
136
        direction += (random(20) - random(20));
137
        con = 0.4;
138
        ux += 50;
139
        dx -= 50;
140
        lx += 50;
141
        rx -= 50;
142
    }
143
    if (con == 0.4)
144
    {
145
        minitimer += 1;
146
        if (minitimer >= 14)
147
            con = 0.5;
148
    }
149
    if (con == 0.5 && speed < 4.4)
150
        speed += 0.2;
151
    if (con == 0.5 && speed >= 4.4)
152
    {
153
        timer += 1;
154
        if (timer >= 170)
155
            con = 1;
156
    }
157
    if (con == 1)
158
    {
159
        speed -= 0.5;
160
        if (speed <= 0.1)
161
            event_user(2);
162
    }
163
}
164
if (type == 4)
165
{
166
    if (con == 0)
167
    {
168
        direction += (random(10) - random(10));
169
        con = 0.5;
170
        ux += 50;
171
        dx -= 50;
172
        lx += 50;
173
        rx -= 50;
174
    }
175
    if (con == 0.5 && speed < 7)
176
        speed += 0.2;
177
    if (con == 0.5 && speed >= 7)
178
    {
179
        timer += 1;
180
        if (timer >= 90)
181
            con = 1;
182
    }
183
    if (con == 1)
184
    {
185
        speed -= 0.5;
186
        if (speed <= 0.1)
187
        {
188
            active = 0;
189
            event_user(2);
190
        }
191
    }
192
}
193
if (type == 5)
194
{
195
    if (con == 0)
196
    {
197
        ux += 30;
198
        dx -= 30;
199
        lx += 30;
200
        rx -= 30;
201
        con = 0.4;
202
    }
203
    if (con == 0.4)
204
    {
205
        minitimer += 1;
206
        if (minitimer >= 14)
207
            con = 0.5;
208
    }
209
    if (con == 0.5 && speed < 4)
210
        speed += 0.2;
211
    if (con == 0.5 && speed >= 4)
212
    {
213
        timer += 1;
214
        if (timer >= 170)
215
            con = 1;
216
    }
217
    if (con == 1)
218
    {
219
        speed -= 0.2;
220
        if (speed <= 0.1)
221
            event_user(2);
222
    }
223
}
224
if (instance_exists(obj_growtangle))
225
{
226
    obj_growtangle.x = x;
227
    obj_growtangle.y = y;
228
    lborder = x - (sprite_width / 2);
229
    rborder = x + (sprite_width / 2);
230
    uborder = y - (sprite_height / 2);
231
    dborder = y + (sprite_height / 2);
232
    if (lborder < lx && hspeed < 0)
233
    {
234
        hspeed = -hspeed;
235
        bumpnoise = 1;
236
    }
237
    if (rborder > rx && hspeed > 0)
238
    {
239
        hspeed = -hspeed;
240
        bumpnoise = 1;
241
    }
242
    if (uborder < ux && vspeed < 0)
243
    {
244
        vspeed = -vspeed;
245
        bumpnoise = 1;
246
    }
247
    if (dborder > dx && vspeed > 0)
248
    {
249
        vspeed = -vspeed;
250
        bumpnoise = 1;
251
    }
252
    if (bumpnoise == 1)
253
    {
254
        snd_play(snd_bump);
255
        snd_play(snd_screenshake);
256
        bumpnoise = 0;
257
        if (!instance_exists(obj_shake))
258
            instance_create(0, 0, obj_shake);
259
    }
260
}
261
if (grazed == 1)
262
{
263
    if (timerbonus == 0)
264
    {
265
        timer += 2;
266
        timerbonus = 1;
267
    }
268
    grazetimer += 1;
269
    if (grazetimer >= 15)
270
    {
271
        timerbonus = 0;
272
        grazetimer = 0;
273
        grazed = 0;
274
    }
275
}