Deltarune (Chapter 4) script viewer

← back to main script listing

gml_Object_obj_rudebuster_bolt_Step_0

(view raw script w/o annotations or w/e)
1
if (image_alpha < 1)
2
    image_alpha += 0.25;
3
else
4
    image_alpha = 1;
5
if (t == 0)
6
{
7
    if (battlemode == 1)
8
    {
9
        targetx = global.monsterx[target.myself];
10
        targety = global.monstery[target.myself];
11
    }
12
    else if (instance_exists(target))
13
    {
14
        targetx = target.x + (target.sprite_width / 2);
15
        targety = target.y + (target.sprite_height / 2);
16
    }
17
    if (global.chapter == 4 && i_ex(obj_hammer_of_justice_enemy))
18
    {
19
        targetx = 200 + target.x + (target.sprite_width / 2);
20
        targety = target.y + (target.sprite_height / 2);
21
    }
22
    if (global.chapter == 4 && i_ex(obj_jackenstein_enemy))
23
    {
24
        targetx = 200 + target.x + (target.sprite_width / 2);
25
        targety = target.y + (target.sprite_height / 2);
26
    }
27
    cx = targetx;
28
    cy = targety;
29
    direction = (point_direction(x, y, cx, cy) - 20) + gersonoffset;
30
    speed = speedmax;
31
    friction = -1.5;
32
    if (global.chapter == 4 && i_ex(obj_hammer_of_justice_enemy) && obj_hammer_of_justice_enemy.rudebusterhitcount == obj_hammer_of_justice_enemy.rudebusterhitcountmax)
33
    {
34
        friction = -5;
35
        direction += 0;
36
        targety = (target.y - 60) + (target.sprite_height / 2);
37
    }
38
    if (global.chapter == 4 && i_ex(obj_jackenstein_enemy))
39
    {
40
        friction = -5;
41
        direction += 0;
42
        targety = (target.y - 60) + (target.sprite_height / 2);
43
    }
44
    image_angle = direction;
45
    if (red == 1)
46
    {
47
        sprite_index = spr_rudebuster_beam_red;
48
        image_xscale = 2.5;
49
        image_yscale = 2.5;
50
    }
51
}
52
if (instance_exists(obj_hammer_of_justice_enemy) && obj_hammer_of_justice_enemy.rudebusterhitcount < obj_hammer_of_justice_enemy.rudebusterhitcountmax && explode == 0)
53
{
54
    gersonswingtimer++;
55
    if (gersonswingtimer == 10)
56
    {
57
        sprite_set_offset(spr_gerson_smash_stop, 25, 40);
58
        obj_hammer_of_justice_enemy.sprite_index = spr_gerson_smash_stop;
59
        obj_hammer_of_justice_enemy.image_index = 0;
60
        obj_hammer_of_justice_enemy.state = 10;
61
        global.spelldelay += 40;
62
    }
63
    if (gersonswingtimer == 17)
64
    {
65
        with (obj_afterimage)
66
            instance_destroy();
67
        speedmax = 0;
68
        hurtflashalpha = 1;
69
        speed = 0;
70
        image_alpha = 1;
71
        
scr_shakeobj
scr_shakeobj

function
scr_shakeobj()
{ var _shakeobj = instance_create(x, y, obj_shakeobj); _shakeobj.target = id; if (argument_count >= 1) { if (i_ex(argument0)) _shakeobj.target = argument0; } if (argument_count >= 2) { if (argument1 != -1) _shakeobj.shakeamt = argument1; } if (argument_count >= 3) { if (argument2 != -1) _shakeobj.shakereduct = argument2; } with (_shakeobj) event_user(0); }
();
72
        instance_create(x, y, obj_shake);
73
        snd_play(snd_rudebuster_hit);
74
    }
75
}
76
if (t >= 1 && explode == 0)
77
{
78
    bolt_timer += 1;
79
    if (button1_p() && bolt_timer >= 4 && chosen_bolt == 0 && lockdamage == false)
80
    {
81
        chosen_bolt = bolt_timer;
82
        lockdamage = true;
83
    }
84
    dir = point_direction(x, y, cx, cy);
85
    direction += (angle_difference(dir, direction) / 4);
86
    if (i_ex(obj_hammer_of_justice_enemy))
87
    {
88
        if (obj_hammer_of_justice_enemy.rudebusterhitcount < obj_hammer_of_justice_enemy.rudebusterhitcountmax)
89
        {
90
            direction += 4;
91
        }
92
        else
93
        {
94
            direction += 8;
95
            if (direction < 10)
96
                direction = 0;
97
        }
98
    }
99
    image_angle = direction;
100
    if (i_ex(obj_hammer_of_justice_enemy) && obj_hammer_of_justice_enemy.state != 14 && obj_hammer_of_justice_enemy.rudebusterhitcount >= obj_hammer_of_justice_enemy.rudebusterhitcountmax)
101
    {
102
        if (x > (camerax() + 500))
103
        {
104
            with (obj_hammer_of_justice_enemy)
105
            {
106
                saverudebusterstarcount = round((other.damage / global.monstermaxhp[0]) * 100);
107
                state = 14;
108
                spinxscale = 1;
109
                spinspeed = 3.05;
110
                snd_play_pitch(snd_wallclaw, 0.7);
111
                global.spelldelay += 33;
112
                if (instance_exists(obj_hammer_of_justice_enemy) && obj_hammer_of_justice_enemy.rudebusterhitcount == obj_hammer_of_justice_enemy.rudebusterhitcountmax && obj_hammer_of_justice_enemy.rudebusterhitcountmax < 3)
113
                    obj_hammer_of_justice_enemy.rudebusterhitcountmax++;
114
            }
115
        }
116
    }
117
    if (x > (camerax() + 640))
118
        instance_destroy();
119
    if (point_distance(x, y, cx, cy) <= 200 && i_ex(obj_jackenstein_enemy) && misswritercreated == false)
120
    {
121
        dmgwriter = instance_create(obj_jackenstein_enemy.x + 40, obj_jackenstein_enemy.y + 40, obj_dmgwriter);
122
        dmgwriter.damage = 0;
123
        dmgwriter.type = 1;
124
        misswritercreated = true;
125
    }
126
    if (point_distance(x, y, cx, cy) <= 40 && !i_ex(obj_hammer_of_justice_enemy) && !i_ex(obj_jackenstein_enemy))
127
    {
128
        final_bolt = bolt_timer;
129
        visible = 0;
130
        explode = 1;
131
        t = 1;
132
        with (obj_hammer_of_justice_enemy)
133
        {
134
            swingtimer = 0;
135
            shakex = 9;
136
            state = 3;
137
            hurttimer = 30;
138
        }
139
        if (i_ex(obj_titan_enemy) && obj_titan_enemy.drawstate == "crack")
140
        {
141
            with (obj_titan_enemy)
142
                redflashtimer = 10;
143
            snd_stop(snd_damage);
144
            snd_stop(snd_queen_punched_lower_heavy);
145
            snd_play(snd_damage);
146
            snd_play(snd_queen_punched_lower_heavy);
147
            
scr_shakescreen
scr_shakescreen

function
scr_shakescreen(arg0 = 4, arg1 = 4)
{ var shaker = instance_create(x, y, obj_shake); if (i_ex(shaker)) { shaker.shakex = arg0; shaker.shakey = arg1; } }
();
148
            with (obj_shake)
149
            {
150
                shakex = 4;
151
                shakey = 4;
152
            }
153
        }
154
        if (sprite_index == spr_rudebuster_beam_green)
155
        {
156
            with (obj_titan_enemy)
157
            {
158
                if (drawstate != "crack")
159
                {
160
                    var delaytime = 2;
161
                    var snd = snd_play_complex(0, 0, undefined);
162
                    snd_add_complex(snd, 0, 236, 0.6, 0.4, (delaytime - 1) + 2, -1, 0);
163
                    snd_add_complex(snd, 1, 390, 0.8, 0.5, (delaytime - 1) + 0, -1, 0);
164
                    snd_add_complex(snd, 2, 390, 0.71, 0.5, (delaytime - 1) + 0, -1, 0);
165
                    snd_add_complex(snd, 3, 269, 0.7, 0.95, (delaytime - 1) + 0, -1, 0);
166
                    drawstate = "crack";
167
                    redflashtimer = 10;
168
                    var _x = camerax() + 500;
169
                    var _y = cameray() + 300;
170
                    var __x = (camerastartx + camerawidth()) - 494;
171
                    var __y = camerastarty - 88;
172
                    var _a = 0;
173
                    repeat (6)
174
                    {
175
                        mark = instance_create(__x, __y, obj_marker);
176
                        mark.sprite_index = spr_titan_star_break;
177
                        mark.image_blend = c_white;
178
                        mark.image_speed = 0;
179
                        mark.image_index = 1 + _a;
180
                        mark.image_xscale = 2;
181
                        mark.image_yscale = 2;
182
                        mark.gravity = 1;
183
                        mark.gravity_direction = 270;
184
                        mark.vspeed = -4 - random(18);
185
                        mark.hspeed = -6 + random(12);
186
                        mark.depth = 10;
187
                        _a++;
188
                    }
189
                    repeat (30)
190
                    {
191
                        mark = instance_create((_x - 40) + random(80), (_y - 40) + random(80), obj_marker);
192
                        mark.sprite_index = spr_gerson_item_throw;
193
                        mark.image_blend = merge_color(c_white, c_black, 0.3);
194
                        mark.image_speed = 0;
195
                        mark.image_index = 3;
196
                        mark.gravity = 1;
197
                        mark.gravity_direction = 270;
198
                        mark.vspeed = -4 - random(18);
199
                        mark.hspeed = -6 + random(12);
200
                        mark.depth = 10;
201
                    }
202
                }
203
            }
204
        }
205
    }
206
}
207
if (explode == 1)
208
{
209
    if (t == 1)
210
    {
211
        bonus_anim = 0;
212
        if (chosen_bolt > 0)
213
        {
214
            if (chosen_bolt == final_bolt)
215
                damage += 30;
216
            if (chosen_bolt == (final_bolt - 1))
217
                damage += 28;
218
            if (chosen_bolt == (final_bolt - 2))
219
                damage += 22;
220
            if (chosen_bolt == (final_bolt - 3))
221
                damage += 20;
222
            if (chosen_bolt == (final_bolt - 4))
223
                damage += 13;
224
            if (chosen_bolt == (final_bolt - 5))
225
                damage += 11;
226
            if (chosen_bolt == (final_bolt - 6))
227
                damage += 10;
228
            if (abs(chosen_bolt - final_bolt) <= 2)
229
            {
230
                bonus_anim = 1;
231
                snd_play(snd_scytheburst);
232
            }
233
        }
234
        if (red == 1)
235
            damage += 90;
236
        if (battlemode == 1)
237
        {
238
            global.hittarget[star] = 0;
239
            if (i_ex(obj_titan_enemy))
240
            {
241
            }
242
            
scr_damage_enemy
scr_damage_enemy

function
scr_damage_enemy(arg0, arg1)
{ dm = instance_create(global.monsterx[arg0], (global.monstery[arg0] + 20) - (global.hittarget[arg0] * 20), obj_dmgwriter); if (caster < 4) { dm.type = global.char[caster] - 1; if (global.char[caster] == 4) dm.type = 6; } if (caster == 5) dm.type = 5; dm.damage = arg1; global.monsterhp[arg0] -= arg1; if (arg1 > 0) { with (global.monsterinstance[arg0]) { shakex = 9; state = 3; hurttimer = 30; } if (i_ex(global.monsterinstance[arg0])) global.monsterinstance[arg0].hurtamt = arg1; } global.hittarget[arg0] += 1; if (arg1 == 0) { with (global.monsterinstance[arg0]) { hurtamt = 0; if (hurttimer <= 15 && candodge == 1) { dodgetimer = 0; state = 4; } } } var a = 0; if (global.chapter == 4 && i_ex(obj_titan_enemy)) { if (global.monsterhp[arg0] < 1) global.monsterhp[arg0] = 1; } if (global.monsterhp[arg0] <= 0 && a == 0) { with (global.monsterinstance[arg0])
scr_monsterdefeat();
} }
(star, damage);
243
            if (sprite_index == spr_rudebuster_beam_green)
244
            {
245
                dm.type = 1.5;
246
                dm.ystart -= 30;
247
            }
248
            if (global.monstertype[0] != 20JEVIL && !i_ex(obj_hammer_of_justice_enemy))
249
            {
250
                with (target)
251
                    __of = 
scr_oflash
scr_oflash

function
scr_oflash()
{ _oflash = instance_create(x, y, obj_oflash); _oflash.image_xscale = image_xscale; _oflash.image_speed = 0; _oflash.image_index = image_index; _oflash.image_yscale = image_yscale; _oflash.sprite_index = sprite_index; _oflash.depth = depth - 1; _oflash.target = id; return _oflash; }
();
252
                if (red == 1)
253
                {
254
                    with (target)
255
                        __of.flashcolor = c_red;
256
                }
257
            }
258
        }
259
        else
260
        {
261
            with (target)
262
                __of = 
scr_oflash
scr_oflash

function
scr_oflash()
{ _oflash = instance_create(x, y, obj_oflash); _oflash.image_xscale = image_xscale; _oflash.image_speed = 0; _oflash.image_index = image_index; _oflash.image_yscale = image_yscale; _oflash.sprite_index = sprite_index; _oflash.depth = depth - 1; _oflash.target = id; return _oflash; }
();
263
            if (red == 1)
264
            {
265
                with (target)
266
                    __of.flashcolor = c_red;
267
            }
268
        }
269
        snd_stop(snd_rudebuster_hit);
270
        snd_play(snd_rudebuster_hit);
271
        for (i = 0; i < 4; i += 1)
272
        {
273
            burst[i] = 
scr_afterimage
scr_afterimage

function
scr_afterimage()
{ afterimage = instance_create(x, y, obj_afterimage); afterimage.sprite_index = sprite_index; afterimage.image_index = image_index; afterimage.image_blend = image_blend; afterimage.image_speed = 0; afterimage.depth = depth; afterimage.image_xscale = image_xscale; afterimage.image_yscale = image_yscale; afterimage.image_angle = image_angle; return afterimage; }
();
274
            burst[i].image_speed = 0.5;
275
            burst[i].x = cx;
276
            burst[i].y = cy;
277
            burst[i].image_angle = 45 + (i * 90);
278
            burst[i].direction = burst[i].image_angle;
279
            burst[i].speed = 25;
280
            if (bonus_anim == 1)
281
                burst[i].speed = 40;
282
            burst[i].depth = depth - 10;
283
        }
284
        for (i = 4; i < 8; i += 1)
285
        {
286
            burst[i] = 
scr_afterimage
scr_afterimage

function
scr_afterimage()
{ afterimage = instance_create(x, y, obj_afterimage); afterimage.sprite_index = sprite_index; afterimage.image_index = image_index; afterimage.image_blend = image_blend; afterimage.image_speed = 0; afterimage.depth = depth; afterimage.image_xscale = image_xscale; afterimage.image_yscale = image_yscale; afterimage.image_angle = image_angle; return afterimage; }
();
287
            burst[i].image_speed = 0.5;
288
            burst[i].x = cx;
289
            burst[i].y = cy;
290
            burst[i].image_angle = 45 + (i * 90);
291
            burst[i].direction = burst[i].image_angle;
292
            burst[i].speed = 25;
293
            if (bonus_anim == 1)
294
                burst[i].speed = 40;
295
            burst[i].depth = depth - 10;
296
        }
297
    }
298
    if (t >= 2)
299
    {
300
        for (i = 0; i < 4; i += 1)
301
        {
302
            with (burst[i])
303
            {
304
                speed *= 0.75;
305
                image_xscale *= 0.8;
306
            }
307
        }
308
        for (i = 4; i < 8; i += 1)
309
        {
310
            with (burst[i])
311
            {
312
                speed *= 0.8;
313
                image_xscale *= 0.8;
314
            }
315
        }
316
    }
317
    if (t >= 18)
318
        instance_destroy();
319
}
320
if (explode == 0 && speed != 0)
321
{
322
    aft[maxaft] = 
scr_afterimage
scr_afterimage

function
scr_afterimage()
{ afterimage = instance_create(x, y, obj_afterimage); afterimage.sprite_index = sprite_index; afterimage.image_index = image_index; afterimage.image_blend = image_blend; afterimage.image_speed = 0; afterimage.depth = depth; afterimage.image_xscale = image_xscale; afterimage.image_yscale = image_yscale; afterimage.image_angle = image_angle; return afterimage; }
();
323
    aft[maxaft].image_yscale = 1.8;
324
    aft[maxaft].image_angle = image_angle;
325
    aft[maxaft].image_index = 4;
326
    aft[maxaft].image_speed = 0.5;
327
    aft[maxaft].image_alpha = image_alpha - 0.2;
328
    if (i_ex(obj_hammer_of_justice_enemy) && obj_hammer_of_justice_enemy.rudebusterhitcount == obj_hammer_of_justice_enemy.rudebusterhitcountmax)
329
        aft[maxaft].fadeSpeed = 0.08;
330
    maxaft += 1;
331
}
332
for (i = 0; i < maxaft; i += 1)
333
{
334
    with (aft[i])
335
    {
336
        image_yscale -= 0.1;
337
        if (image_yscale <= 0.1)
338
            instance_destroy();
339
    }
340
    if (explode == 1)
341
    {
342
        with (aft[i])
343
        {
344
            image_alpha -= 0.07;
345
            image_yscale *= 0.9;
346
            if (image_yscale <= 0.1)
347
                instance_destroy();
348
        }
349
    }
350
}
351
a += 1;
352
t += 1;