Deltarune (Chapter 2) script viewer

← back to main script listing

gml_Object_obj_saucer_Step_0

(view raw script w/o annotations or w/e)
1
scr_depth
scr_depth

function scr_depth() { depth = 100000 - ((y * 10) + (sprite_height * 10)); }
();
2
if (i_ex(obj_dogtable_controlled))
3
    myinteract = 0;
4
if (mode == 0 || mode == 3)
5
{
6
    if (con == 0 && myinteract == 1)
7
    {
8
        snd_play(snd_wing);
9
        lid = instance_create(x, y, obj_marker);
10
        lid.depth = depth - 100;
11
        lid.vspeed = -4 * multiplier;
12
        lid.friction = -0.2 * multiplier;
13
        lid.sprite_index = sprite_index;
14
        lid.image_speed = 0;
15
        lid.image_index = 2;
16
        lid.image_xscale = 2;
17
        lid.image_yscale = 2;
18
        image_index = 1;
19
        myinteract = 0;
20
        con = 1;
21
        makecontent = 0;
22
        if (content >= 2)
23
        {
24
            makecontent = 1;
25
            contentmarker = instance_create(x + xoffset, y + yoffset, obj_marker);
26
            contentmarker.depth = depth - 1;
27
            contentmarker.sprite_index = contentsprite;
28
            contentmarker.image_speed = 0.1 * multiplier;
29
            contentmarker.image_xscale = 2;
30
            contentmarker.image_yscale = 2;
31
        }
32
        if (mode == 3 && contentsprite == spr_ch2_gimmick_saucer_key)
33
        {
34
            snd_play(snd_sparkle_glock);
35
            with (obj_saucer)
36
            {
37
                if (mode == 3)
38
                    mode = -1;
39
            }
40
            mode = 3;
41
            var myKeyXpos = contentmarker.x;
42
            var myKeyYpos = contentmarker.y;
43
            if (room == room_dw_mansion_east_2f_a || room == room_dw_mansion_east_2f_shortcut)
44
            {
45
                contentmarker.image_alpha = 0;
46
                if (instance_exists(obj_ch2_room_mansion_east_2f_a))
47
                {
48
                    with (obj_ch2_room_mansion_east_2f_a)
49
                    {
50
                        keyXPos = myKeyXpos;
51
                        keyYPos = myKeyYpos;
52
                        con = 1;
53
                    }
54
                }
55
                if (instance_exists(obj_ch2_room_mansion_2f_shortcut))
56
                {
57
                    with (obj_ch2_room_mansion_2f_shortcut)
58
                    {
59
                        keyXPos = myKeyXpos;
60
                        keyYPos = myKeyYpos;
61
                        con = 1;
62
                    }
63
                }
64
            }
65
        }
66
        if (mode == 3 && contentsprite == spr_ch2_gimmick_saucer_bomb)
67
        {
68
            if (contentsprite == spr_ch2_gimmick_saucer_bomb)
69
                activated_bomb = 1;
70
            with (obj_saucer)
71
            {
72
                if (mode == 3)
73
                {
74
                    mode = 4;
75
                    con = 1;
76
                }
77
            }
78
            with (obj_saucer_monty)
79
                con = 6;
80
            exit;
81
        }
82
    }
83
}
84
if (mode == 1)
85
{
86
    if (con == 0 && myinteract == 1)
87
    {
88
        if (montyboss == 0 || montyboss == 1)
89
            snd_play(snd_wing);
90
        if (room == room_dw_mansion_dining3)
91
            global.interact = 1;
92
        siner = 0;
93
        lid = instance_create(x, y, obj_marker);
94
        lid.depth = depth - 100;
95
        lid.sprite_index = sprite_index;
96
        lid.image_speed = 0;
97
        lid.image_index = 2;
98
        lid.image_xscale = 2;
99
        lid.image_yscale = 2;
100
        image_index = 1;
101
        myinteract = 0;
102
        con = 1;
103
        makecontent = 0;
104
        if (content == 1 && floor(random(5)) == 1)
105
        {
106
            makecontent = 1;
107
            contentmarker = instance_create(x, y, obj_marker);
108
            contentmarker.depth = depth - 1;
109
            contentmarker.sprite_index = spr_ch2_gimmick_saucer_dog;
110
            contentmarker.image_speed = 0.1 * multiplier;
111
            contentmarker.image_xscale = 2;
112
            contentmarker.image_yscale = 2;
113
        }
114
        if (content >= 2)
115
        {
116
            makecontent = 1;
117
            contentmarker = instance_create(x, y, obj_marker);
118
            contentmarker.depth = depth - 1;
119
            contentmarker.sprite_index = contentsprite;
120
            contentmarker.image_speed = 0.1 * multiplier;
121
            contentmarker.image_xscale = 2;
122
            contentmarker.image_yscale = 2;
123
        }
124
    }
125
    if (con == 1)
126
    {
127
        done = 0;
128
        siner += 1;
129
        if (content == 1)
130
            height = sin(siner / (8 / multiplier)) * 60;
131
        else
132
            height = sin(siner / (15 / multiplier)) * 80;
133
        lid.y = lid.ystart - height;
134
        if (siner >= 10 && height <= 0)
135
        {
136
            if (montyboss == 0 || montyboss == 1)
137
                snd_play(snd_metalhit);
138
            height = 0;
139
            siner = 0;
140
            con = 0;
141
            myinteract = 0;
142
            lid.y = lid.ystart;
143
            image_index = 0;
144
            with (lid)
145
                instance_destroy();
146
            if (makecontent == 1)
147
            {
148
                with (contentmarker)
149
                    instance_destroy();
150
            }
151
            if (room == room_dw_mansion_dining3)
152
                global.interact = 0;
153
            if (instance_exists(obj_controller_dining3))
154
                obj_controller_dining3.checkCount++;
155
        }
156
    }
157
}
158
if (mode == 2)
159
{
160
    if (con == 0 && myinteract == 1 && global.facing != 2 && room == room_dw_mansion_east_2f_c_a)
161
        myinteract = 0;
162
    if (con == 0 && myinteract == 1)
163
    {
164
        snd_play_pitch(snd_hypnosis, 1.4);
165
        ufo = instance_create(x, y, obj_saucer_ufo);
166
        image_index = 3;
167
        myinteract = 0;
168
        con = 1;
169
    }
170
    yrange = 30;
171
    if (con == 0 && activated && (charaY() > (y - yrange) && charaY() < (y + yrange + sprite_height)))
172
    {
173
        snd_play_pitch(snd_hypnosis, 1.4);
174
        ufo = instance_create(x, y, obj_saucer_ufo);
175
        image_index = 3;
176
        myinteract = 0;
177
        con = 1;
178
    }
179
}
180
if (mode == 4)
181
{
182
    if (con == 1)
183
    {
184
        timer = 0;
185
        flashtimer = 0;
186
        con = 2;
187
    }
188
    if (con == 2)
189
    {
190
        flashtimer += (1 * multiplier);
191
        if (flashtimer >= 8)
192
        {
193
            if (activated_bomb)
194
            {
195
                if (image_index != 6)
196
                    image_index = 6;
197
                else
198
                    image_index = 1;
199
            }
200
            else if (image_index != 5)
201
            {
202
                image_index = 5;
203
            }
204
            else
205
            {
206
                image_index = 0;
207
            }
208
            flashtimer = 0;
209
        }
210
        timer += (1 * multiplier);
211
        if (timer >= 120)
212
        {
213
            if (montyboss == 1)
214
                snd_play(snd_explosion_mmx);
215
            midx = x + (sprite_width / 2);
216
            midy = y + (sprite_height / 2);
217
            explosion = instance_create(midx, midy, obj_textbomb_explosion);
218
            explosion.image_xscale = 3;
219
            explosion.image_yscale = 3;
220
            for (i = 0; i < 8; i += 1)
221
            {
222
                bullet = instance_create(midx, midy, obj_saucer_ufo_bullet);
223
                bullet.direction = i * 45;
224
                bullet.speed = 1 * multiplier;
225
                bullet.friction = -0.08 * multiplier;
226
                bullet.image_angle = bullet.direction;
227
                bullet.explosiontype = 1;
228
            }
229
            if (makecontent == 1)
230
            {
231
                with (contentmarker)
232
                    instance_destroy();
233
            }
234
            if (i_ex(collider))
235
                instance_destroy(collider);
236
            instance_destroy();
237
        }
238
    }
239
}
240
if (mode == 5)
241
{
242
    if (con == 0 && myinteract == 1)
243
    {
244
        lid = instance_create(x, y, obj_marker);
245
        lid.depth = depth - 100;
246
        lid.vspeed = -4 * multiplier;
247
        lid.friction = -0.2 * multiplier;
248
        lid.sprite_index = sprite_index;
249
        lid.image_speed = 0;
250
        lid.image_index = 2;
251
        lid.image_xscale = 2;
252
        lid.image_yscale = 2;
253
        image_index = 1;
254
        myinteract = 0;
255
        con = 1;
256
        makecontent = 0;
257
        if (content >= 2)
258
        {
259
            makecontent = 1;
260
            contentmarker = instance_create(x + 30, y + 12, obj_treasure_room);
261
            contentmarker.depth = depth - 1;
262
            contentmarker.sprite_index = spr_treasurebox;
263
            contentmarker.image_speed = 0;
264
            contentmarker.image_xscale = 2;
265
            contentmarker.image_yscale = 2;
266
            with (contentmarker)
267
            {
268
                itemid = other.itemid;
269
                itemtype = other.itemtype;
270
                itemflag = other.itemflag;
271
            }
272
        }
273
    }
274
}
275
if (mode == 6)
276
    image_index = 3;