Deltarune script viewer

← back to main script listing

gml_Object_obj_sneo_faceattack_Step_0

(view raw script w/o annotations or w/e)
1
if (init == 0)
2
{
3
    if (type == 0)
4
        sprite_index = spr_spamtonneo_faceAttack_face;
5
    if (type == 1)
6
        sprite_index = spr_spamtonneo_faceAttack_eyes;
7
    if (type == 2)
8
        sprite_index = spr_spamtonneo_faceAttack_nose;
9
    if (type == 3)
10
        sprite_index = spr_spamtonneo_faceAttack_mouth;
11
    if (!first_time)
12
        event_user(2);
13
    if (type >= 1)
14
    {
15
        image_index = 1;
16
        if (hp <= 0)
17
        {
18
            broken = 1;
19
            image_index = 2;
20
        }
21
    }
22
    if (type == 0)
23
        depth += 10;
24
    init = 1;
25
    if (first_time)
26
    {
27
        image_alpha = 1;
28
        xstart = x;
29
        growtangle_x = obj_growtangle.x;
30
        x = camerax() + 730;
31
    }
32
}
33
if (first_time)
34
{
35
    if (intro_timer == 0)
36
    {
37
        x -= smashspeed;
38
        smashspeed += 0.5;
39
        if (x < xstart)
40
        {
41
            intro_timer = 15;
42
            if (type == 0)
43
            {
44
                scr_shakescreen
scr_shakescreen

function scr_shakescreen() { instance_create(x, y, obj_shake); }
();
45
                snd_play(snd_closet_impact);
46
            }
47
        }
48
    }
49
    if (intro_timer > 0)
50
    {
51
        intro_timer--;
52
        if (intro_timer == 0)
53
        {
54
            first_time = false;
55
            x = xstart;
56
            if (type == 0)
57
            {
58
                intro_timer = -1;
59
                with (obj_growtangle)
60
                    x = other.growtangle_x;
61
            }
62
            event_user(2);
63
        }
64
        else
65
        {
66
            x = xstart - (sin(pi * (intro_timer / 15)) * 20);
67
            if (type == 0)
68
            {
69
                with (obj_growtangle)
70
                    x = other.growtangle_x - (sin(pi * (other.intro_timer / 15)) * 20);
71
            }
72
        }
73
    }
74
    if (first_time)
75
        exit;
76
}
77
if (broken == 1 && type != 0 && destroytarget == 0)
78
{
79
    with (targ)
80
        instance_destroy();
81
    destroytarget = 1;
82
}
83
timer++;
84
if (image_alpha < 1 && global.turntimer > 21)
85
    image_alpha += 0.1;
86
if (explodetimer > 0)
87
{
88
    var xx = 0;
89
    var yy = 0;
90
    if (type == 1)
91
    {
92
        xx = 58;
93
        yy = 32;
94
    }
95
    if (type == 2)
96
    {
97
        xx = 30;
98
        yy = 64;
99
    }
100
    if (type == 3)
101
    {
102
        xx = 48;
103
        yy = 102;
104
    }
105
    if ((explodetimer % 2) == 0)
106
    {
107
        cres = instance_create(((x + xx) - 25) + random(50), ((y + yy) - 25) + random(50), obj_boxing_crescent);
108
        cres.depth = depth - 100;
109
    }
110
    explodetimer--;
111
}
112
var brokencounter = 0;
113
with (obj_sneo_faceattack)
114
{
115
    if (broken == 1)
116
        brokencounter++;
117
}
118
if (type == 1 && broken == 0)
119
{
120
    if (timer == 30 || laserinit == 0)
121
    {
122
        brokenmod = brokencounter;
123
        lasex = -10 + x + 56;
124
        lasey = y + 32;
125
        laserdir = point_direction(lasex, lasey, obj_heart.x + 10, obj_heart.y + 10);
126
        laserinit = 1;
127
    }
128
    if (timer >= 30 && (timer % 3) == 0)
129
    {
130
        if (global.turntimer > 21)
131
        {
132
            laser = instance_create(lasex, lasey, obj_werewire_bullet_lasercircle);
133
            scr_bullet_inherit
scr_bullet_inherit

function scr_bullet_inherit(arg0) { if (i_ex(arg0)) { if (damage != -1) arg0.damage = damage; if (grazepoints != -1) arg0.grazepoints = grazepoints; if (timepoints != -1) arg0.timepoints = timepoints; if (inv != -1) arg0.inv = inv; if (target != -1) arg0.target = target; if (grazed != -1) arg0.grazed = 0; if (grazetimer != -1) arg0.grazetimer = 0; arg0.element = element; } }
(laser);
134
            laser.my_angle = laserdir;
135
            if (brokenmod == 2)
136
                laser.my_angle = laserdir + (brokenmod * random_range(-8, 8));
137
            laser.my_speed = 7;
138
            laser.my_accel = 0 + (brokenmod * 0.25);
139
            laser.image_yscale = 2;
140
            laser.my_angle_change = 0;
141
            laser.target = target;
142
            laser.damage = damage;
143
            laser.element = 6;
144
            shootflashtimer = 3;
145
        }
146
    }
147
    if (timer == 50)
148
        timer = 0 + (brokenmod * 5);
149
}
150
if (type == 2 && broken == 0)
151
{
152
    if (timer >= 70 && noseinit == 0)
153
    {
154
        brokenmod = brokencounter;
155
        noseinit = 1;
156
    }
157
    if (timer >= 80 && (timer % 5) == 0)
158
    {
159
        var randomvspeed = random_range(-2, 2);
160
        for (var i = 0; i < 3; i++)
161
        {
162
            bullet = instance_create(x, y, obj_regularbullet);
163
            scr_bullet_inherit
scr_bullet_inherit

function scr_bullet_inherit(arg0) { if (i_ex(arg0)) { if (damage != -1) arg0.damage = damage; if (grazepoints != -1) arg0.grazepoints = grazepoints; if (timepoints != -1) arg0.timepoints = timepoints; if (inv != -1) arg0.inv = inv; if (target != -1) arg0.target = target; if (grazed != -1) arg0.grazed = 0; if (grazetimer != -1) arg0.grazetimer = 0; arg0.element = element; } }
(bullet);
164
            bullet.sprite_index = spr_spamtonneo_faceAttack_nose_bullet;
165
            bullet.mask_index = spr_spamtonneo_faceAttack_nose_bullet_mask;
166
            scr_darksize
scr_darksize

function scr_darksize(arg0) { inst = arg0; inst.image_xscale = 2; inst.image_yscale = 2; }
(bullet);
167
            bullet.gravity = 0.6;
168
            bullet.gravity_direction = 180;
169
            bullet.friction = 0.4;
170
            bullet.vspeed = -4 + (i * 4.5);
171
            if (brokenmod == 2)
172
                bullet.vspeed += randomvspeed;
173
            bullet.hspeed = -3;
174
            bullet.target = target;
175
            bullet.damage = damage;
176
            bullet.element = 6;
177
            shootflashtimer = 3;
178
        }
179
    }
180
    if (timer == 90)
181
        timer = 26 + (brokenmod * 10);
182
}
183
if (type == 3 && broken == 0)
184
{
185
    if (timer >= 10 && eyesinit == 0)
186
    {
187
        eyesinit = 1;
188
        brokenmod = brokencounter;
189
    }
190
    if (timer >= 10)
191
        image_index = 3;
192
    if (timer >= 10 && (timer % 6) == 0)
193
    {
194
        bullet = instance_create(x + 30, y + 98, obj_regularbullet);
195
        bullet.sprite_index = spr_spamtonneo_faceAttack_wisp;
196
        scr_bullet_inherit
scr_bullet_inherit

function scr_bullet_inherit(arg0) { if (i_ex(arg0)) { if (damage != -1) arg0.damage = damage; if (grazepoints != -1) arg0.grazepoints = grazepoints; if (timepoints != -1) arg0.timepoints = timepoints; if (inv != -1) arg0.inv = inv; if (target != -1) arg0.target = target; if (grazed != -1) arg0.grazed = 0; if (grazetimer != -1) arg0.grazetimer = 0; arg0.element = element; } }
(bullet);
197
        bullet.hspeed = random_range(-4, -7);
198
        bullet.vspeed = random_range(6, -2);
199
        if (obj_heart.y >= obj_growtangle.y)
200
            bullet.vspeed += 1;
201
        bullet.gravity = -0.2;
202
        bullet.target = target;
203
        bullet.damage = damage;
204
        bullet.element = 6;
205
        shootflashtimer = 3;
206
    }
207
    if (timer == 42)
208
    {
209
        image_index = 1;
210
        timer = -40 + (brokenmod * 20);
211
    }
212
}
213
if (scr_debug
scr_debug

function scr_debug() { if (global.debug == 1) return 1; }
())
214
{
215
    if (keyboard_check_pressed(ord("U")))
216
    {
217
        if (type == 1)
218
            broken = true;
219
    }
220
    if (keyboard_check_pressed(ord("I")))
221
    {
222
        if (type == 2)
223
            broken = true;
224
    }
225
    if (keyboard_check_pressed(ord("O")))
226
    {
227
        if (type == 3)
228
            broken = true;
229
    }
230
}
231
if ((type == 1 || type == 2) && broken == 1)
232
    image_index = 2;
233
if (type == 3 && broken == 1)
234
    image_index = 4;