Deltarune (Chapter 3) 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
        if (i_ex(obj_knight_enemy))
12
            targety -= 50;
13
    }
14
    else if (i_ex(target))
15
    {
16
        targetx = target.x + (target.sprite_width / 2);
17
        targety = target.y + (target.sprite_height / 2);
18
    }
19
    cx = targetx;
20
    cy = targety;
21
    direction = point_direction(x, y, cx, cy) - 20;
22
    speed = 24;
23
    friction = -1.5;
24
    image_angle = direction;
25
    if (red == 1)
26
    {
27
        sprite_index = spr_rudebuster_beam_red;
28
        image_xscale = 2.5;
29
        image_yscale = 2.5;
30
    }
31
}
32
if (t >= 1 && explode == 0)
33
{
34
    bolt_timer += 1;
35
    if (button1_p() && bolt_timer >= 4 && chosen_bolt == 0 && lockdamage == false)
36
    {
37
        chosen_bolt = bolt_timer;
38
        lockdamage = true;
39
    }
40
    dir = point_direction(x, y, cx, cy);
41
    direction += (angle_difference(dir, direction) / 4);
42
    image_angle = direction;
43
    if (point_distance(x, y, cx, cy) <= 40)
44
    {
45
        final_bolt = bolt_timer;
46
        visible = 0;
47
        explode = 1;
48
        t = 1;
49
    }
50
}
51
if (explode == 1)
52
{
53
    if (t == 1)
54
    {
55
        bonus_anim = 0;
56
        if (chosen_bolt > 0)
57
        {
58
            if (chosen_bolt == final_bolt)
59
                damage += 30;
60
            if (chosen_bolt == (final_bolt - 1))
61
                damage += 28;
62
            if (chosen_bolt == (final_bolt - 2))
63
                damage += 22;
64
            if (chosen_bolt == (final_bolt - 3))
65
                damage += 20;
66
            if (chosen_bolt == (final_bolt - 4))
67
                damage += 13;
68
            if (chosen_bolt == (final_bolt - 5))
69
                damage += 11;
70
            if (chosen_bolt == (final_bolt - 6))
71
                damage += 10;
72
            if (abs(chosen_bolt - final_bolt) <= 2)
73
            {
74
                bonus_anim = 1;
75
                snd_play(snd_scytheburst);
76
            }
77
        }
78
        if (red == 1)
79
            damage += 90;
80
        if (battlemode == 1)
81
        {
82
            global.hittarget[star] = 0;
83
            if (i_ex(obj_knight_enemy))
84
                damage = round(damage / 2);
85
            
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 (global.chapter == 3 && i_ex(obj_knight_enemy) && arg1 >= 100) obj_knight_enemy.stronghurtanim = true; } 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.monsterhp[arg0] <= 0 && a == 0) { with (global.monsterinstance[arg0])
scr_monsterdefeat();
} }
(star, damage);
86
            if (global.monstertype[0] != 20 && global.monstertype[0] != 103Tenna)
87
            {
88
                with (target)
89
                    __of = 
scr_oflash
scr_oflash

function
scr_oflash(arg0 = false)
{ var _oflash = instance_create_depth(x, y, depth - 1, obj_oflash); _oflash.image_xscale = image_xscale; _oflash.image_yscale = image_yscale; _oflash.image_speed = 0; _oflash.image_index = image_index; _oflash.sprite_index = sprite_index; _oflash.target = id; _oflash.follow = arg0; return _oflash; }
();
90
                if (red == 1)
91
                {
92
                    with (target)
93
                        __of.flashcolor = c_red;
94
                }
95
            }
96
        }
97
        else
98
        {
99
            with (target)
100
                __of = 
scr_oflash
scr_oflash

function
scr_oflash(arg0 = false)
{ var _oflash = instance_create_depth(x, y, depth - 1, obj_oflash); _oflash.image_xscale = image_xscale; _oflash.image_yscale = image_yscale; _oflash.image_speed = 0; _oflash.image_index = image_index; _oflash.sprite_index = sprite_index; _oflash.target = id; _oflash.follow = arg0; return _oflash; }
();
101
            if (red == 1)
102
            {
103
                with (target)
104
                    __of.flashcolor = c_red;
105
            }
106
        }
107
        snd_play(snd_rudebuster_hit);
108
        for (i = 0; i < 4; i += 1)
109
        {
110
            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; }
();
111
            burst[i].image_speed = 0.5;
112
            burst[i].x = cx;
113
            burst[i].y = cy;
114
            burst[i].image_angle = 45 + (i * 90);
115
            burst[i].direction = burst[i].image_angle;
116
            burst[i].speed = 25;
117
            if (bonus_anim == 1)
118
                burst[i].speed = 40;
119
            burst[i].depth = depth - 10;
120
        }
121
        for (i = 4; i < 8; 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
            if (bonus_anim == 1)
131
                burst[i].speed = 40;
132
            burst[i].depth = depth - 10;
133
        }
134
    }
135
    if (t >= 2)
136
    {
137
        for (i = 0; i < 4; i += 1)
138
        {
139
            with (burst[i])
140
            {
141
                speed *= 0.75;
142
                image_xscale *= 0.8;
143
            }
144
        }
145
        for (i = 4; i < 8; i += 1)
146
        {
147
            with (burst[i])
148
            {
149
                speed *= 0.8;
150
                image_xscale *= 0.8;
151
            }
152
        }
153
    }
154
    if (t >= 18)
155
        instance_destroy();
156
}
157
if (explode == 0)
158
{
159
    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; }
();
160
    aft[maxaft].image_yscale = 1.8;
161
    aft[maxaft].image_angle = image_angle;
162
    aft[maxaft].image_index = 4;
163
    aft[maxaft].image_speed = 0.5;
164
    aft[maxaft].image_alpha = image_alpha - 0.2;
165
    maxaft += 1;
166
}
167
for (i = 0; i < maxaft; i += 1)
168
{
169
    with (aft[i])
170
    {
171
        image_yscale -= 0.1;
172
        if (image_yscale <= 0.1)
173
            instance_destroy();
174
    }
175
    if (explode == 1)
176
    {
177
        with (aft[i])
178
        {
179
            image_alpha -= 0.07;
180
            image_yscale *= 0.9;
181
            if (image_yscale <= 0.1)
182
                instance_destroy();
183
        }
184
    }
185
}
186
a += 1;
187
t += 1;