Deltarune 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
                scr_damage_enemy
scr_damage_enemy

function scr_damage_enemy(argument0, argument1) //gml_Script_scr_damage_enemy { dm = instance_create(global.monsterx[argument0], (global.monstery[argument0] + 20 - global.hittarget[argument0] * 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 = argument1 global.monsterhp[argument0] -= argument1 if (argument1 > 0) { with (global.monsterinstance[argument0]) { shakex = 9 state = 3 hurttimer = 30 } if i_ex(global.monsterinstance[argument0]) global.monsterinstance[argument0].hurtamt = argument1 } global.hittarget[argument0] += 1 if (argument1 == 0) { with (global.monsterinstance[argument0]) { hurtamt = 0 if (hurttimer <= 15 && candodge == 1) { dodgetimer = 0 state = 4 } } } if (global.chapter == 2 && i_ex(obj_sweet_enemy) && global.monsterhp[argument0] <= 0) global.monsterhp[argument0] = 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[argument0] <= 0 && a == 0) { with (global.monsterinstance[argument0]) scr_monsterdefeat() } if (global.chapter == 2 && global.monsterhp[argument0] <= 0 && a == 3) { with (global.monsterinstance[argument0]) endcon = 1 } }
(star, damage)
97
            if (global.monstertype[0] != 20JEVIL)
98
            {
99
                with (target)
100
                    __of = scr_oflash
scr_oflash

function scr_oflash() //gml_Script_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; }
()
101
                if (red == 1)
102
                {
103
                    with (target)
104
                        __of.flashcolor = c_red
105
                }
106
            }
107
        }
108
        else
109
        {
110
            with (target)
111
                __of = scr_oflash
scr_oflash

function scr_oflash() //gml_Script_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; }
()
112
            if (red == 1)
113
            {
114
                with (target)
115
                    __of.flashcolor = c_red
116
            }
117
        }
118
        snd_play(snd_rudebuster_hit)
119
        for (i = 0; i < 4; i += 1)
120
        {
121
            burst[i] = scr_afterimage
scr_afterimage

function scr_afterimage() //gml_Script_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; }
()
122
            burst[i].image_speed = 0.5
123
            burst[i].x = cx
124
            burst[i].y = cy
125
            burst[i].image_angle = 45 + i * 90
126
            burst[i].direction = burst[i].image_angle
127
            burst[i].speed = 25
128
            burst[i].depth = depth - 10
129
        }
130
        for (i = 4; i < 8; i += 1)
131
        {
132
            burst[i] = scr_afterimage
scr_afterimage

function scr_afterimage() //gml_Script_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; }
()
133
            burst[i].image_speed = 0.5
134
            burst[i].x = cx
135
            burst[i].y = cy
136
            burst[i].image_angle = 45 + i * 90
137
            burst[i].direction = burst[i].image_angle
138
            burst[i].speed = 25
139
            burst[i].depth = depth - 10
140
        }
141
    }
142
    if (t >= 2)
143
    {
144
        for (i = 0; i < 4; i += 1)
145
        {
146
            with (burst[i])
147
            {
148
                speed *= 0.75
149
                image_xscale *= 0.8
150
            }
151
        }
152
        for (i = 4; i < 8; i += 1)
153
        {
154
            with (burst[i])
155
            {
156
                speed *= 0.8
157
                image_xscale *= 0.8
158
            }
159
        }
160
    }
161
    if (t >= 18)
162
        instance_destroy()
163
}
164
if (explode == 0)
165
{
166
    aft[maxaft] = scr_afterimage
scr_afterimage

function scr_afterimage() //gml_Script_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; }
()
167
    aft[maxaft].image_yscale = 1.8
168
    aft[maxaft].image_angle = image_angle
169
    aft[maxaft].image_index = 4
170
    aft[maxaft].image_speed = 0.5
171
    aft[maxaft].image_alpha = image_alpha - 0.2
172
    maxaft += 1
173
}
174
for (i = 0; i < maxaft; i += 1)
175
{
176
    with (aft[i])
177
    {
178
        image_yscale -= 0.1
179
        if (image_yscale <= 0.1)
180
            instance_destroy()
181
    }
182
    if (explode == 1)
183
    {
184
        with (aft[i])
185
        {
186
            image_alpha -= 0.07
187
            image_yscale *= 0.9
188
            if (image_yscale <= 0.1)
189
                instance_destroy()
190
        }
191
    }
192
}
193
a += 1
194
t += 1