Deltarune (Chapter 2) 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
        if (instance_exists(obj_queenshield_enemy))
10
        {
11
            depth = obj_queenshield_enemy.depth - 1;
12
            targetx = obj_queenshield_enemy.x + 24;
13
            targety = obj_queenshield_enemy.y + 140;
14
        }
15
        else
16
        {
17
            targetx = global.monsterx[target.myself];
18
            targety = global.monstery[target.myself];
19
        }
20
    }
21
    else if (i_ex(target))
22
    {
23
        targetx = target.x + (target.sprite_width / 2);
24
        targety = target.y + (target.sprite_height / 2);
25
    }
26
    cx = targetx;
27
    cy = targety;
28
    direction = point_direction(x, y, cx, cy) - 20;
29
    speed = 24;
30
    friction = -1.5;
31
    image_angle = direction;
32
    if (red == 1)
33
    {
34
        sprite_index = spr_rudebuster_beam_red;
35
        image_xscale = 2.5;
36
        image_yscale = 2.5;
37
    }
38
}
39
if (t >= 1 && explode == 0)
40
{
41
    bolt_timer += 1;
42
    if (button1_p() && bolt_timer >= 4 && chosen_bolt == 0)
43
        chosen_bolt = bolt_timer;
44
    dir = point_direction(x, y, cx, cy);
45
    direction += (angle_difference(dir, direction) / 4);
46
    image_angle = direction;
47
    if (point_distance(x, y, cx, cy) <= 40)
48
    {
49
        final_bolt = chosen_bolt;
50
        visible = 0;
51
        explode = 1;
52
        t = 1;
53
    }
54
}
55
if (explode == 1)
56
{
57
    if (t == 1)
58
    {
59
        bonus_anim = 0;
60
        if (chosen_bolt > 0)
61
        {
62
            if (chosen_bolt == final_bolt)
63
                damage += 30;
64
            if (chosen_bolt == (final_bolt - 1))
65
                damage += 28;
66
            if (chosen_bolt == (final_bolt - 2))
67
                damage += 22;
68
            if (chosen_bolt == (final_bolt - 3))
69
                damage += 20;
70
            if (chosen_bolt == (final_bolt - 4))
71
                damage += 13;
72
            if (chosen_bolt == (final_bolt - 5))
73
                damage += 11;
74
            if (chosen_bolt == (final_bolt - 6))
75
                damage += 10;
76
            if (abs(chosen_bolt - final_bolt) <= 2)
77
            {
78
                bonus_anim = 1;
79
                snd_play(snd_scytheburst);
80
            }
81
        }
82
        if (red == 1)
83
            damage += 90;
84
        if (battlemode == 1)
85
        {
86
            global.hittarget[star] = 0;
87
            if (instance_exists(obj_queenshield_enemy))
88
            {
89
                obj_queen_enemy.shieldhp -= damage;
90
                with (obj_queenshield_enemy)
91
                    con = 1;
92
                with (obj_queenshield_enemy)
93
                    event_user(0);
94
            }
95
            else
96
            {
97
                
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; } } } if (global.chapter == 2 && i_ex(obj_sweet_enemy) && global.monsterhp[arg0] <= 0) global.monsterhp[arg0] = 1; var a = 0; if (global.chapter == 2 && i_ex(obj_queen_enemy)) a = 1; if (global.chapter == 2 && i_ex(obj_spamton_neo_enemy)) a = 2; if (global.chapter == 2 && i_ex(obj_berdlyb_enemy)) a = 3; if (global.monsterhp[arg0] <= 0 && a == 0) { with (global.monsterinstance[arg0])
scr_monsterdefeat();
} if (global.chapter == 2 && global.monsterhp[arg0] <= 0 && a == 3) { with (global.monsterinstance[arg0]) endcon = 1; } }
(star, damage);
98
            }
99
            if (global.monstertype[0] != 20JEVIL)
100
            {
101
                with (target)
102
                    __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; if (global.chapter == 2 && object_index == obj_mauswheel_enemy) _oflash.sprite_index = spr_mauswheel_idle; else _oflash.sprite_index = sprite_index; _oflash.depth = depth - 1; _oflash.target = id; return _oflash; }
();
103
                if (red == 1)
104
                {
105
                    with (target)
106
                        __of.flashcolor = c_red;
107
                }
108
            }
109
        }
110
        else
111
        {
112
            with (target)
113
                __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; if (global.chapter == 2 && object_index == obj_mauswheel_enemy) _oflash.sprite_index = spr_mauswheel_idle; else _oflash.sprite_index = sprite_index; _oflash.depth = depth - 1; _oflash.target = id; return _oflash; }
();
114
            if (red == 1)
115
            {
116
                with (target)
117
                    __of.flashcolor = c_red;
118
            }
119
        }
120
        snd_play(snd_rudebuster_hit);
121
        for (i = 0; i < 4; i += 1)
122
        {
123
            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; }
();
124
            burst[i].image_speed = 0.5;
125
            burst[i].x = cx;
126
            burst[i].y = cy;
127
            burst[i].image_angle = 45 + (i * 90);
128
            burst[i].direction = burst[i].image_angle;
129
            burst[i].speed = 25;
130
            burst[i].depth = depth - 10;
131
        }
132
        for (i = 4; i < 8; i += 1)
133
        {
134
            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; }
();
135
            burst[i].image_speed = 0.5;
136
            burst[i].x = cx;
137
            burst[i].y = cy;
138
            burst[i].image_angle = 45 + (i * 90);
139
            burst[i].direction = burst[i].image_angle;
140
            burst[i].speed = 25;
141
            burst[i].depth = depth - 10;
142
        }
143
    }
144
    if (t >= 2)
145
    {
146
        for (i = 0; i < 4; i += 1)
147
        {
148
            with (burst[i])
149
            {
150
                speed *= 0.75;
151
                image_xscale *= 0.8;
152
            }
153
        }
154
        for (i = 4; i < 8; i += 1)
155
        {
156
            with (burst[i])
157
            {
158
                speed *= 0.8;
159
                image_xscale *= 0.8;
160
            }
161
        }
162
    }
163
    if (t >= 18)
164
        instance_destroy();
165
}
166
if (explode == 0)
167
{
168
    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; }
();
169
    aft[maxaft].image_yscale = 1.8;
170
    aft[maxaft].image_angle = image_angle;
171
    aft[maxaft].image_index = 4;
172
    aft[maxaft].image_speed = 0.5;
173
    aft[maxaft].image_alpha = image_alpha - 0.2;
174
    maxaft += 1;
175
}
176
for (i = 0; i < maxaft; i += 1)
177
{
178
    with (aft[i])
179
    {
180
        image_yscale -= 0.1;
181
        if (image_yscale <= 0.1)
182
            instance_destroy();
183
    }
184
    if (explode == 1)
185
    {
186
        with (aft[i])
187
        {
188
            image_alpha -= 0.07;
189
            image_yscale *= 0.9;
190
            if (image_yscale <= 0.1)
191
                instance_destroy();
192
        }
193
    }
194
}
195
a += 1;
196
t += 1;