Deltarune (Chapter 2) script viewer

← back to main script listing

gml_Object_obj_sneo_wireheart_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;
23
    var yscale = 1;
24
    if (type == 1)
25
    {
26
        xscale = 1;
27
        yscale = 1;
28
        sprite_index = spr_sneo_wireheart_smaller;
29
        moveframes *= 0.8;
30
        hp = 10;
31
    }
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_xscale", 0.5, xscale, 20, -1, "out");
33
    
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");
34
    if (type == 3)
35
    {
36
        sprite_index = spr_sneo_wireheart_biter;
37
        hp = 3;
38
        moveframes = 12;
39
    }
40
    if (type == 4)
41
    {
42
        sprite_index = spr_sneo_wireheart_bomb;
43
        hp = 1;
44
    }
45
}
46
if (con == 1)
47
{
48
    if (bighearttype == 1)
49
        moveframes = 16;
50
    targetx = camerax() + 300 + random(70);
51
    targety = cameray() + 145 + random_range(-70, 70);
52
    if (type == 3)
53
    {
54
        if (altbiter > 0 && altbiter < 3)
55
        {
56
            targetx = camerax() + 150;
57
            if (altbiter == 1)
58
                targety = cameray() + 240;
59
            else
60
                targety = cameray() + 75;
61
        }
62
        else
63
        {
64
            targetx = camerax() + 170 + random(70);
65
            targety = cameray() + 145 + random_range(-60, 60);
66
        }
67
        if (altbiter == 3)
68
        {
69
            targetx = camerax() + 350;
70
            targety = cameray() + 130 + random_range(-45, 0);
71
        }
72
        if (altbiter == 4)
73
        {
74
            targetx = camerax() + 350;
75
            targety = cameray() + 160 + random_range(45, 0);
76
        }
77
    }
78
    if (i_ex(obj_heart) && obj_sneo_bulletcontroller.hearttargettimer < 1 && type != 3)
79
    {
80
        if (choose(0, 1, 2) == 0)
81
        {
82
            targety = obj_heart.y + 10;
83
            obj_sneo_bulletcontroller.hearttargettimer = 6;
84
        }
85
    }
86
    movetimer = 0;
87
    con = 2;
88
    if (type == 0 || type == 1)
89
    {
90
        with (boss)
91
            heart_release_con = 1;
92
    }
93
}
94
if (con == 2)
95
{
96
    movetimer += (1 / moveframes);
97
    x = lerp_ease_out(bossx, targetx, movetimer, 2);
98
    y = lerp_ease_out(bossy, targety, movetimer, 2);
99
    if (movetimer >= 1)
100
    {
101
        movetimer = 0;
102
        con = 3;
103
    }
104
}
105
if (con == 3)
106
{
107
    if (type == 3 && altbiter > 0 && altbiter < 3)
108
    {
109
        movetimer++;
110
        if (altbiter == 1)
111
            y = lerp(cameray() + 240, cameray() + 75, movetimer / 21);
112
        if (altbiter == 2)
113
            y = lerp(cameray() + 75, cameray() + 240, movetimer / 21);
114
        if (movetimer >= 20)
115
        {
116
            movetimer = 0;
117
            con = 10;
118
            targety = y;
119
        }
120
    }
121
    if (type == 3 && altbiter > 2)
122
    {
123
        movetimer++;
124
        if (movetimer == 1)
125
            instance_create(x, y, obj_sneo_heart_laser);
126
        if (movetimer >= 16)
127
        {
128
            movetimer = 0;
129
            con = 10;
130
        }
131
    }
132
    else
133
    {
134
        con = 10;
135
        movetimer = 0;
136
    }
137
}
138
if (con == 10)
139
{
140
    movetimer += (1 / moveframes);
141
    x = lerp_ease_in(targetx, bossx, movetimer, 2);
142
    y = lerp_ease_in(targety, bossy, movetimer, 2);
143
    if ((movetimer > 0.5 && type == 0) || (movetimer > 0.5 && type == 1 && obj_spamton_neo_enemy.difficulty > 2))
144
    {
145
        with (boss)
146
            heart_release_con = 0;
147
    }
148
    if (movetimer >= 1)
149
    {
150
        movetimer = 0;
151
        shottimer = 0;
152
        con = 1;
153
    }
154
}
155
if (con == 2 || con == 3 || con == 10)
156
{
157
    var radial = 5;
158
    if (abs((x - targetx) / (targetx - bossx)) < 0.2)
159
    {
160
        shottimer--;
161
        if (shottimer <= 0)
162
        {
163
            if (type == 0)
164
            {
165
                firedtimer = 4;
166
                var dir = 0;
167
                if (bighearttype == 1 && y < obj_growtangle.y)
168
                    dir = 25 + random(10);
169
                if (bighearttype == 1 && y > obj_growtangle.y)
170
                    dir = (random(10) * -1) - 25;
171
                for (i = 0; i < radial; i++)
172
                {
173
                    radialshot = instance_create(x, y, obj_collidebullet);
174
                    with (radialshot)
175
                        
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; }
();
176
                    radialshot.sprite_index = spr_diamondbullet;
177
                    radialshot.direction = ((i / radial) * 180) + 110 + dir;
178
                    if (special == 1)
179
                        radialshot.direction += random_range(-10, 10);
180
                    radialshot.image_angle = radialshot.direction;
181
                    radialshot.active = 1;
182
                    radialshot.speed = 1;
183
                    radialshot.friction = -0.3;
184
                    if (bighearttype == 1)
185
                    {
186
                        radialshot.speed = 1;
187
                        radialshot.friction = -0.23;
188
                    }
189
                    radialshot.depth = depth - 1;
190
                    radialshot.target = target;
191
                    radialshot.damage = damage;
192
                    radialshot.grazed = 0;
193
                    radialshot.element = 6;
194
                    if (obj_spamton_neo_enemy.difficulty == 0)
195
                        radialshot.grazepoints = 3;
196
                    if (obj_spamton_neo_enemy.difficulty == 2)
197
                        radialshot.grazepoints = 2;
198
                }
199
                shottimer = 10;
200
                if (bighearttype == 1)
201
                    shottimer = 6;
202
            }
203
            else if (type == 1)
204
            {
205
                firedtimer = 4;
206
                for (i = 0; i < radial; i++)
207
                {
208
                    radialshot = instance_create(x, y, obj_collidebullet);
209
                    with (radialshot)
210
                        
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; }
();
211
                    radialshot.sprite_index = spr_diamondbullet;
212
                    radialshot.direction = point_direction(radialshot.x, radialshot.y, obj_heart.x + 10, obj_heart.y + 10);
213
                    radialshot.image_angle = radialshot.direction;
214
                    radialshot.image_xscale = 0.5;
215
                    radialshot.image_yscale = 0.5;
216
                    radialshot.active = 1;
217
                    radialshot.speed = 3;
218
                    radialshot.friction = -0.2;
219
                    radialshot.depth = depth - 1;
220
                    radialshot.target = target;
221
                    radialshot.damage = damage;
222
                    radialshot.grazed = 0;
223
                    radialshot.element = 6;
224
                }
225
                shottimer = 6;
226
            }
227
        }
228
    }
229
}