Deltarune (Chapter 2) script viewer

← back to main script listing

gml_Object_obj_sneo_wireheart_old_Step_0

(view raw script w/o annotations or w/e)
1
if (init == 0)
2
{
3
    image_xscale = 0.5;
4
    image_yscale = 0.5;
5
    destroyed = 0;
6
    shotcount = 0;
7
    bouncecount = 0;
8
    shottype = 0;
9
    shottimer = 0;
10
    init = 1;
11
    con = 1;
12
    if (i_ex(boss))
13
    {
14
        rembossx = boss.x;
15
        rembossy = boss.y;
16
    }
17
    else
18
    {
19
        rembossx = bossx;
20
        rembossy = bossy;
21
    }
22
    var xscale = 1.5;
23
    var yscale = 1.5;
24
    if (type == 1)
25
    {
26
        xscale = 1;
27
        yscale = 1;
28
        moveframes *= 0.8;
29
        hp = 10;
30
    }
31
    scr_lerpvar
scr_lerpvar

function scr_lerpvar() { if (argument_count < 6) ___lerpvar = scr_lerpvar_instance(id, argument[0], argument[1], argument[2], argument[3]); else ___lerpvar = scr_lerpvar_instance(id, argument[0], argument[1], argument[2], argument[3], argument[4], argument[5]); return ___lerpvar; }
("image_xscale", 0.5, xscale, 20, -1, "out");
32
    scr_lerpvar
scr_lerpvar

function scr_lerpvar() { if (argument_count < 6) ___lerpvar = scr_lerpvar_instance(id, argument[0], argument[1], argument[2], argument[3]); else ___lerpvar = scr_lerpvar_instance(id, argument[0], argument[1], argument[2], argument[3], argument[4], argument[5]); return ___lerpvar; }
("image_yscale", 0.5, yscale, 20, -1, "out");
33
    if (type == 3)
34
    {
35
        sprite_index = spr_sneo_wireheart_biter;
36
        hp = 3;
37
        moveframes = 12;
38
    }
39
    if (type == 4)
40
    {
41
        sprite_index = spr_sneo_wireheart_bomb;
42
        hp = 1;
43
    }
44
}
45
if (con == 1)
46
{
47
    if (bighearttype == 1)
48
        moveframes = 16;
49
    targetx = camerax() + 300 + random(70);
50
    targety = cameray() + 145 + random_range(-70, 70);
51
    if (type == 3)
52
    {
53
        if (altbiter > 0 && altbiter < 3)
54
        {
55
            targetx = camerax() + 150;
56
            if (altbiter == 1)
57
                targety = cameray() + 240;
58
            else
59
                targety = cameray() + 75;
60
        }
61
        else
62
        {
63
            targetx = camerax() + 170 + random(70);
64
            targety = cameray() + 145 + random_range(-60, 60);
65
        }
66
        if (altbiter == 3)
67
        {
68
            targetx = camerax() + 350;
69
            targety = cameray() + 130 + random_range(-45, 0);
70
        }
71
        if (altbiter == 4)
72
        {
73
            targetx = camerax() + 350;
74
            targety = cameray() + 160 + random_range(45, 0);
75
        }
76
    }
77
    if (i_ex(obj_heart) && obj_sneo_bulletcontroller.hearttargettimer < 1 && type != 3)
78
    {
79
        if (choose(0, 1, 2) == 0)
80
        {
81
            targety = obj_heart.y + 10;
82
            obj_sneo_bulletcontroller.hearttargettimer = 6;
83
        }
84
    }
85
    movetimer = 0;
86
    con = 2;
87
    if (type == 0 || type == 1)
88
    {
89
        with (boss)
90
            heart_release_con = 1;
91
    }
92
}
93
if (con == 2)
94
{
95
    movetimer += (1 / moveframes);
96
    x = lerp_ease_out(bossx, targetx, movetimer, 2);
97
    y = lerp_ease_out(bossy, targety, movetimer, 2);
98
    if (movetimer >= 1)
99
    {
100
        movetimer = 0;
101
        con = 3;
102
    }
103
}
104
if (con == 3)
105
{
106
    if (type == 3 && altbiter > 0 && altbiter < 3)
107
    {
108
        movetimer++;
109
        if (altbiter == 1)
110
            y = lerp(cameray() + 240, cameray() + 75, movetimer / 21);
111
        if (altbiter == 2)
112
            y = lerp(cameray() + 75, cameray() + 240, movetimer / 21);
113
        if (movetimer >= 20)
114
        {
115
            movetimer = 0;
116
            con = 10;
117
            targety = y;
118
        }
119
    }
120
    if (type == 3 && altbiter > 2)
121
    {
122
        movetimer++;
123
        if (movetimer == 1)
124
            instance_create(x, y, obj_sneo_heart_laser);
125
        if (movetimer >= 16)
126
        {
127
            movetimer = 0;
128
            con = 10;
129
        }
130
    }
131
    else
132
    {
133
        con = 10;
134
        movetimer = 0;
135
    }
136
}
137
if (con == 10)
138
{
139
    movetimer += (1 / moveframes);
140
    x = lerp_ease_in(targetx, bossx, movetimer, 2);
141
    y = lerp_ease_in(targety, bossy, movetimer, 2);
142
    if ((movetimer > 0.5 && type == 0) || (movetimer > 0.5 && type == 1 && obj_spamton_neo_enemy.difficulty > 2))
143
    {
144
        with (boss)
145
            heart_release_con = 0;
146
    }
147
    if (movetimer >= 1)
148
    {
149
        movetimer = 0;
150
        shottimer = 0;
151
        con = 1;
152
    }
153
}
154
if (con == 2 || con == 3 || con == 10)
155
{
156
    var radial = 5;
157
    if (abs((x - targetx) / (targetx - bossx)) < 0.2)
158
    {
159
        shottimer--;
160
        if (shottimer <= 0)
161
        {
162
            if (type == 0)
163
            {
164
                firedtimer = 4;
165
                var dir = 0;
166
                if (bighearttype == 1 && y < obj_growtangle.y)
167
                    dir = 25 + random(10);
168
                if (bighearttype == 1 && y > obj_growtangle.y)
169
                    dir = (random(10) * -1) - 25;
170
                for (i = 0; i < radial; i++)
171
                {
172
                    radialshot = instance_create(x, y, obj_collidebullet);
173
                    with (radialshot)
174
                        scr_bullet_init
scr_bullet_init

function scr_bullet_init() { grazed = 0; grazetimer = 0; destroyonhit = 1; target = 0; inv = 60; damage = 10; element = 0; grazepoints = 1; timepoints = 1; active = 1; updateimageangle = 0; }
();
175
                    radialshot.sprite_index = spr_diamondbullet;
176
                    radialshot.direction = ((i / radial) * 180) + 110 + dir;
177
                    radialshot.image_angle = radialshot.direction;
178
                    radialshot.active = 1;
179
                    radialshot.speed = 1;
180
                    radialshot.friction = -0.3;
181
                    if (bighearttype == 1)
182
                    {
183
                        radialshot.speed = 1;
184
                        radialshot.friction = -0.23;
185
                    }
186
                    radialshot.depth = depth - 1;
187
                    radialshot.target = target;
188
                    radialshot.damage = damage;
189
                    radialshot.grazed = 0;
190
                    radialshot.element = 6;
191
                }
192
                shottimer = 10;
193
                if (bighearttype == 1)
194
                    shottimer = 6;
195
            }
196
            else if (type == 1)
197
            {
198
                firedtimer = 4;
199
                for (i = 0; i < radial; i++)
200
                {
201
                    radialshot = instance_create(x, y, obj_collidebullet);
202
                    with (radialshot)
203
                        scr_bullet_init
scr_bullet_init

function scr_bullet_init() { grazed = 0; grazetimer = 0; destroyonhit = 1; target = 0; inv = 60; damage = 10; element = 0; grazepoints = 1; timepoints = 1; active = 1; updateimageangle = 0; }
();
204
                    radialshot.sprite_index = spr_diamondbullet;
205
                    radialshot.direction = point_direction(radialshot.x, radialshot.y, obj_heart.x + 10, obj_heart.y + 10);
206
                    radialshot.image_angle = radialshot.direction;
207
                    radialshot.image_xscale = 0.5;
208
                    radialshot.image_yscale = 0.5;
209
                    radialshot.active = 1;
210
                    radialshot.speed = 3;
211
                    radialshot.friction = -0.2;
212
                    radialshot.depth = depth - 1;
213
                    radialshot.target = target;
214
                    radialshot.damage = damage;
215
                    radialshot.grazed = 0;
216
                    radialshot.element = 6;
217
                }
218
                shottimer = 6;
219
            }
220
        }
221
    }
222
}