Deltarune (Chapter 4) script viewer

← back to main script listing

gml_Object_obj_gerson_rudebuster_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 ((button1_p() || button2_p() || button3_p()) && hurtflashalpha == 0 && explode == 0 && obj_herosusie.hurt == 0)
6
    buffer_z = 2;
7
if (buffer_z > 0 && hurtflashalpha == 0 && explode == 0 && obj_herosusie.hurt == 0)
8
{
9
    if (susieattackcon == 0)
10
    {
11
        snd_play(snd_ultraswing);
12
        snd_play(snd_ultraswing);
13
        susieattackcon = 1;
14
        with (obj_herosusie)
15
        {
16
            x = xstart;
17
            sprite_set_offset(spr_susie_hitback_miss, 18, 9);
18
            
scr_battle_sprite_set
scr_battle_sprite_set

function
scr_battle_sprite_set(arg0, arg1, arg2, arg3)
{ _charactor = arg0; _charinstance = obj_herokris; if (_charactor == "noelle") { _charinstance = obj_heronoelle; _charnum = 4; } if (_charactor == "ralsei") { _charinstance = obj_heroralsei; _charnum = 3; } if (_charactor == "susie") { _charinstance = obj_herosusie; _charnum = 2; } if (_charactor == "kris") { _charinstance = obj_herokris; _charnum = 1; } if (instance_exists(_charinstance)) { with (_charinstance) { state = 8; hurt = 0; attacktimer = 0; sprite_index = arg1; image_speed = arg2; image_index = 0; if (arg3 == 0) maxframes = image_number; global.faceaction[myself] = 0; } } }
("susie", spr_susie_hitback_miss, 0.5, 0);
19
        }
20
    }
21
}
22
if (susieattackcon == 1)
23
{
24
    susieattacktimer++;
25
    if (susieattacktimer == 4)
26
    {
27
        with (obj_gerson_slowdown)
28
        {
29
            con = 1;
30
            timer = 0;
31
        }
32
        if (x < (camerax() + 330))
33
        {
34
            hitback = true;
35
            
scr_battle_sprite_set
scr_battle_sprite_set

function
scr_battle_sprite_set(arg0, arg1, arg2, arg3)
{ _charactor = arg0; _charinstance = obj_herokris; if (_charactor == "noelle") { _charinstance = obj_heronoelle; _charnum = 4; } if (_charactor == "ralsei") { _charinstance = obj_heroralsei; _charnum = 3; } if (_charactor == "susie") { _charinstance = obj_herosusie; _charnum = 2; } if (_charactor == "kris") { _charinstance = obj_herokris; _charnum = 1; } if (instance_exists(_charinstance)) { with (_charinstance) { state = 8; hurt = 0; attacktimer = 0; sprite_index = arg1; image_speed = arg2; image_index = 0; if (arg3 == 0) maxframes = image_number; global.faceaction[myself] = 0; } } }
("susie", spr_susie_hitback, 0.5, 0);
36
            with (obj_herosusie)
37
                image_index = 2;
38
            
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); }
();
39
            instance_create(x, y, obj_shake);
40
            snd_play(snd_criticalswing);
41
            with (obj_afterimage)
42
                instance_destroy();
43
            susieattackcon = 2;
44
            susieattacktimer = 0;
45
            hurtflashalpha = 1;
46
            direction = 0;
47
            x += 10;
48
            inst = instance_create_depth((obj_heroparent.x + 54 + 20) - 36, obj_heroparent.y - 64 - 18, obj_herosusie.depth - 9, obj_animation);
49
            inst.sprite_index = spr_gerson_hit_fx4;
50
            inst.image_speed = 0.5;
51
            inst.image_angle = 0;
52
            inst.image_xscale = 2;
53
            inst.image_yscale = 2;
54
            with (instance_create(camerax(), cameray(), obj_afterimage_screen))
55
                faderate = 0.05;
56
        }
57
    }
58
    if (susieattacktimer == 9)
59
    {
60
        susieattackcon = 0;
61
        susieattacktimer = 0;
62
    }
63
}
64
if (susieattackcon == 2)
65
{
66
    susieattacktimer++;
67
    obj_heroparent.x += 1;
68
    if (susieattacktimer == 2)
69
    {
70
        inst = instance_create_depth((obj_heroparent.x + 190) - 36, (obj_heroparent.y + 40) - 10, obj_herosusie.depth - 10, obj_animation);
71
        inst.sprite_index = spr_susie_gerson_hitbback_fx_1;
72
        inst.image_speed = 1;
73
        inst.image_angle = 0;
74
        inst.image_xscale = 3;
75
        inst.image_yscale = 3;
76
    }
77
    if (susieattacktimer == 10)
78
    {
79
        susieattackcon = 0;
80
        susieattacktimer = 0;
81
        with (obj_herosusie)
82
            image_index = 12;
83
        inst = instance_create_depth((obj_heroparent.x + 200) - 36, (obj_heroparent.y + 40) - 10, obj_herosusie.depth - 10, obj_animation);
84
        inst.sprite_index = spr_susie_gerson_hitbback_fx_2;
85
        inst.image_speed = 1;
86
        inst.image_angle = 0;
87
        inst.image_xscale = 3;
88
        inst.image_yscale = 3;
89
        
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); }
();
90
        instance_create(x, y, obj_shake);
91
        snd_play(snd_rudebuster_hit);
92
        snd_play(snd_rudebuster_swing);
93
        blast = instance_create((obj_heroparent.x + 180) - 36, (obj_heroparent.y + 60) - 18, obj_rudebuster_bolt);
94
        blast.caster = 0;
95
        blast.target = 1435;
96
        blast.damage = ceil(((global.battlemag[1] * 5) + (global.battleat[1] * 11)) - (global.monsterdf[0] * 3));
97
        blast.star = 0;
98
        blast.speedmax = 10;
99
        blast.image_alpha = 1;
100
        blast.direction = 0;
101
        blast.gersonswingtimer = 4;
102
        blast.gersonoffset = -20;
103
        with (obj_particle_generic)
104
            instance_destroy();
105
        instance_destroy();
106
    }
107
    exit;
108
}
109
buffer_z--;
110
if (t == 0)
111
{
112
    if (instance_exists(target))
113
    {
114
        targetx = target.x + (target.sprite_width / 2);
115
        targety = target.y + (target.sprite_height / 2);
116
    }
117
    cx = targetx;
118
    cy = targety;
119
    direction = point_direction(x, y, cx, cy) - 20;
120
    speed = 9;
121
    friction = -1.5;
122
    image_angle = direction;
123
}
124
if (t >= 1 && explode == 0)
125
{
126
    dir = point_direction(x, y, cx, cy);
127
    direction += (angle_difference(dir, direction) / 4);
128
    image_angle = direction;
129
    if (point_distance(x, y, cx, cy) <= 40)
130
    {
131
        speed = speed == 0.96;
132
        hitsusietimer++;
133
        if (hitsusietimer == 2 && hitback == false)
134
        {
135
            visible = 0;
136
            explode = 1;
137
            t = 1;
138
        }
139
    }
140
}
141
if (explode == 1)
142
{
143
    with (obj_herosusie)
144
    {
145
        
scr_battle_sprite_reset
scr_battle_sprite_reset

function
scr_battle_sprite_reset(arg0)
{ _charactor = arg0; _charinstance = obj_herokris; if (_charactor == "noelle") { _charinstance = obj_heronoelle; _charnum = 4; } if (_charactor == "ralsei") { _charinstance = obj_heroralsei; _charnum = 3; } if (_charactor == "susie") { _charinstance = obj_herosusie; _charnum = 2; } if (_charactor == "kris") { _charinstance = obj_herokris; _charnum = 1; } if (instance_exists(_charinstance)) { with (_charinstance) { state = 0; hurt = 0; attacktimer = 0; attacked = 0; global.faceaction[myself] = 0; } } }
("susie");
146
        hurt = 1;
147
        hurttimer = 0;
148
    }
149
    with (obj_gerson_slowdown)
150
    {
151
        con = 1;
152
        timer = 0;
153
    }
154
    susieattackcon = 0;
155
    susieattacktimer = 0;
156
    buffer_z = 0;
157
    if (t == 1)
158
    {
159
        var b = (global.hp[2] - 30) / 250;
160
        if (b < 0)
161
            b = 0;
162
        damage = lerp(12, 90, b);
163
        global.inv = -1;
164
        obj_hammer_of_justice_enemy.rudebusterhitcount = 0;
165
        obj_hammer_of_justice_enemy.progress += 6;
166
        obj_hammer_of_justice_enemy.mercylaughcon = 1;
167
        obj_hammer_of_justice_enemy.mercylaughcount = 6;
168
        
scr_damage_all
scr_damage_all

function
scr_damage_all(arg0 = 1)
{ if (global.inv < 0) { remdamage = damage; _temptarget = target; for (ti = 0; ti < 3; ti += 1) { global.inv = -1; damage = remdamage; var _inverse_proportion = 1 - arg0; var _damscale = global.hp[global.char[ti]] / global.maxhp[global.char[ti]]; var _dammod = (_damscale * _inverse_proportion) + (1 * arg0); damage *= _dammod; target = ti; if (global.hp[global.char[ti]] > 0 && global.char[ti] != 0)
scr_damage();
} global.inv = global.invc * 40; target = _temptarget; } }
();
169
        bonus_anim = 0;
170
        with (obj_hammer_of_justice_enemy)
171
        {
172
            if (susiehitbyrudebustercount == 0 && rudebusterhitcountmax == 1)
173
                susiehitbyrudebustercon = 1;
174
            susiehitbyrudebustercount++;
175
            rudebusterdelay = 20;
176
        }
177
        with (target)
178
        {
179
            _oflash = instance_create(x, y, obj_oflash_gerson_buster);
180
            _oflash.image_xscale = image_xscale;
181
            _oflash.image_speed = 0;
182
            _oflash.image_index = image_index;
183
            _oflash.image_yscale = image_yscale;
184
            _oflash.sprite_index = spr_susieb_hurt;
185
            _oflash.depth = depth - 1;
186
            _oflash.target = id;
187
        }
188
        snd_play(snd_rudebuster_hit);
189
        for (i = 0; i < 4; i += 1)
190
        {
191
            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; }
();
192
            burst[i].image_speed = 0.5;
193
            burst[i].x = cx;
194
            burst[i].y = cy;
195
            burst[i].image_angle = 45 + (i * 90);
196
            burst[i].direction = burst[i].image_angle;
197
            burst[i].speed = 25;
198
            burst[i].depth = depth - 10;
199
        }
200
        for (i = 4; i < 8; i += 1)
201
        {
202
            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; }
();
203
            burst[i].image_speed = 0.5;
204
            burst[i].x = cx;
205
            burst[i].y = cy;
206
            burst[i].image_angle = 45 + (i * 90);
207
            burst[i].direction = burst[i].image_angle;
208
            burst[i].speed = 25;
209
            burst[i].depth = depth - 10;
210
        }
211
    }
212
    if (t >= 2)
213
    {
214
        for (i = 0; i < 4; i += 1)
215
        {
216
            with (burst[i])
217
            {
218
                speed *= 0.75;
219
                image_xscale *= 0.8;
220
            }
221
        }
222
        for (i = 4; i < 8; i += 1)
223
        {
224
            with (burst[i])
225
            {
226
                speed *= 0.8;
227
                image_xscale *= 0.8;
228
            }
229
        }
230
    }
231
    if (t >= 18)
232
        instance_destroy();
233
}
234
if (explode == 0 && speed != 0)
235
{
236
    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; }
();
237
    aft[maxaft].image_yscale = 1.8;
238
    aft[maxaft].image_angle = image_angle;
239
    aft[maxaft].image_index = 4;
240
    aft[maxaft].image_speed = 0.5;
241
    aft[maxaft].image_alpha = image_alpha - 0.2;
242
    maxaft += 1;
243
}
244
for (i = 0; i < maxaft; i += 1)
245
{
246
    with (aft[i])
247
    {
248
        image_yscale -= 0.1;
249
        if (image_yscale <= 0.1)
250
            instance_destroy();
251
    }
252
    if (explode == 1)
253
    {
254
        with (aft[i])
255
        {
256
            image_alpha -= 0.07;
257
            image_yscale *= 0.9;
258
            if (image_yscale <= 0.1)
259
                instance_destroy();
260
        }
261
    }
262
}
263
a += 1;
264
t += 1;