Deltarune (Chapter 1) 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
    targetx = global.monsterx[target.myself];
8
    targety = global.monstery[target.myself];
9
    cx = targetx;
10
    cy = targety;
11
    direction = point_direction(x, y, cx, cy) - 20;
12
    speed = 24;
13
    friction = -1.5;
14
    image_angle = direction;
15
    if (red == 1)
16
    {
17
        sprite_index = spr_rudebuster_beam_red;
18
        image_xscale = 2.5;
19
        image_yscale = 2.5;
20
    }
21
}
22
if (t >= 1 && explode == 0)
23
{
24
    bolt_timer += 1;
25
    if (button1_p() && bolt_timer >= 4 && chosen_bolt == 0)
26
        chosen_bolt = bolt_timer;
27
    dir = point_direction(x, y, cx, cy);
28
    direction += (angle_difference(dir, direction) / 4);
29
    image_angle = direction;
30
    if (point_distance(x, y, cx, cy) <= 40)
31
    {
32
        final_bolt = chosen_bolt;
33
        visible = 0;
34
        explode = 1;
35
        t = 1;
36
    }
37
}
38
if (explode == 1)
39
{
40
    if (t == 1)
41
    {
42
        bonus_anim = 0;
43
        if (chosen_bolt > 0)
44
        {
45
            if (chosen_bolt == final_bolt)
46
                damage += 30;
47
            if (chosen_bolt == (final_bolt - 1))
48
                damage += 28;
49
            if (chosen_bolt == (final_bolt - 2))
50
                damage += 22;
51
            if (chosen_bolt == (final_bolt - 3))
52
                damage += 20;
53
            if (chosen_bolt == (final_bolt - 4))
54
                damage += 13;
55
            if (chosen_bolt == (final_bolt - 5))
56
                damage += 11;
57
            if (chosen_bolt == (final_bolt - 6))
58
                damage += 10;
59
            if (abs(chosen_bolt - final_bolt) <= 2)
60
            {
61
                bonus_anim = 1;
62
                snd_play(snd_scytheburst);
63
            }
64
        }
65
        if (red == 1)
66
            damage += 90;
67
        global.hittarget[star] = 0;
68
        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); dm.type = global.char[caster] - 1; dm.damage = arg1; global.monsterhp[arg0] -= arg1; if (arg1 > 0) { with (global.monsterinstance[arg0]) { shakex = 9; state = 3; hurttimer = 30; } if (instance_exists(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.monsterhp[arg0] <= 0) { with (global.monsterinstance[arg0]) scr_monsterdefeat(); } }
(star, damage);
69
        if (global.monstertype[0] != 20JEVIL)
70
        {
71
            with (target)
72
                __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; }
();
73
            if (red == 1)
74
            {
75
                with (target)
76
                    __of.flashcolor = c_red;
77
            }
78
        }
79
        snd_play(snd_rudebuster_hit);
80
        for (i = 0; i < 4; i += 1)
81
        {
82
            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; }
();
83
            burst[i].image_speed = 0.5;
84
            burst[i].x = cx;
85
            burst[i].y = cy;
86
            burst[i].image_angle = 45 + (i * 90);
87
            burst[i].direction = burst[i].image_angle;
88
            burst[i].speed = 25;
89
            burst[i].depth = depth - 10;
90
        }
91
        for (i = 4; i < 8; i += 1)
92
        {
93
            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; }
();
94
            burst[i].image_speed = 0.5;
95
            burst[i].x = cx;
96
            burst[i].y = cy;
97
            burst[i].image_angle = 45 + (i * 90);
98
            burst[i].direction = burst[i].image_angle;
99
            burst[i].speed = 25;
100
            burst[i].depth = depth - 10;
101
        }
102
    }
103
    if (t >= 2)
104
    {
105
        for (i = 0; i < 4; i += 1)
106
        {
107
            with (burst[i])
108
            {
109
                speed *= 0.75;
110
                image_xscale *= 0.8;
111
            }
112
        }
113
        for (i = 4; i < 8; i += 1)
114
        {
115
            with (burst[i])
116
            {
117
                speed *= 0.8;
118
                image_xscale *= 0.8;
119
            }
120
        }
121
    }
122
    if (t >= 18)
123
        instance_destroy();
124
}
125
if (explode == 0)
126
{
127
    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; }
();
128
    aft[maxaft].image_yscale = 1.8;
129
    aft[maxaft].image_angle = image_angle;
130
    aft[maxaft].image_index = 4;
131
    aft[maxaft].image_speed = 0.5;
132
    aft[maxaft].image_alpha = image_alpha - 0.2;
133
    maxaft += 1;
134
}
135
for (i = 0; i < maxaft; i += 1)
136
{
137
    with (aft[i])
138
    {
139
        image_yscale -= 0.1;
140
        if (image_yscale <= 0.1)
141
            instance_destroy();
142
    }
143
    if (explode == 1)
144
    {
145
        with (aft[i])
146
        {
147
            image_alpha -= 0.07;
148
            image_yscale *= 0.9;
149
            if (image_yscale <= 0.1)
150
                instance_destroy();
151
        }
152
    }
153
}
154
a += 1;
155
t += 1;