Deltarune (Chapter 2) script viewer

← back to main script listing

gml_Object_obj_queen_search_gun_Step_0

(view raw script w/o annotations or w/e)
1
if (init == 0)
2
{
3
    if (firsttime)
4
        targetTime *= 2;
5
    init = 1;
6
    event_user(0);
7
}
8
if (loading > 0)
9
    exit;
10
if (smashed)
11
{
12
    timer++;
13
    if (timer >= 30)
14
    {
15
        var _xx = x + 
scr_orbitx
scr_orbitx

function
scr_orbitx(arg0, arg1, arg2, arg3, arg4)
{ if (arg4 == 0) return arg2; var __theta = point_direction(arg0, arg1, arg2, arg3); var __radius = point_distance(arg0, arg1, arg2, arg3); __theta += arg4; return arg0 + lengthdir_x(__radius, __theta); }
(0, 0, 64 * flip, -20, image_angle);
16
        var _yy = y + 
scr_orbity
scr_orbity

function
scr_orbity(arg0, arg1, arg2, arg3, arg4)
{ if (arg4 == 0) return arg3; var __theta = point_direction(arg0, arg1, arg2, arg3); var __radius = point_distance(arg0, arg1, arg2, arg3); __theta += arg4; return arg1 + lengthdir_y(__radius, __theta); }
(0, 0, 64 * flip, -20, image_angle);
17
        d = instance_create(_xx, _yy, obj_regularbullet);
18
        d.sprite_index = spr_spadebullet;
19
        d.image_angle = image_angle + (flip ? 0 : 180);
20
        d.damage = damage;
21
        d.target = target;
22
        d.speed = 12;
23
        obj_queen_search_flail.broken = 1;
24
        d.direction = image_angle + (flip ? 0 : 180);
25
        instance_destroy();
26
    }
27
    exit;
28
}
29
if (bufferstate == 0 && 
scr_queen_buffercheck
scr_queen_buffercheck

function
scr_queen_buffercheck()
{ return instance_exists(obj_queen_buffercontroller) && obj_queen_buffercontroller.buffering == 1; }
())
30
{
31
    image_blend = c_gray;
32
    bufferstate = 1;
33
}
34
else if (bufferstate == 1 && !
scr_queen_buffercheck
scr_queen_buffercheck

function
scr_queen_buffercheck()
{ return instance_exists(obj_queen_buffercontroller) && obj_queen_buffercontroller.buffering == 1; }
())
35
{
36
    image_blend = c_white;
37
    bufferstate = 2;
38
}
39
if (bufferstate == 1)
40
    exit;
41
if (timer < targetTime && shootcon == 0 && shootmode == 0)
42
{
43
    timer++;
44
    if (timer < 0)
45
        exit;
46
    if (firsttime)
47
    {
48
        if (shottype == 0)
49
        {
50
            targetx = obj_heart.x + 8;
51
            targety = obj_heart.y + 8;
52
            targetAngle = point_direction(x, y - 24, targetx, targety);
53
            targetAngle %= 360;
54
            if (flip)
55
                targetAngle += 360;
56
            else
57
                targetAngle -= 540;
58
        }
59
    }
60
    image_angle = lerp(0, targetAngle, 
scr_ease_inout
scr_ease_inout

function
scr_ease_inout(arg0, arg1)
{ if (arg1 < -3 || arg1 > 7) return arg0; if (arg1 == -3) return ease_inout_bounce(arg0, 0, 1, 1); else if (arg1 == -2) return ease_inout_elastic(arg0, 0, 1, 1); else if (arg1 == -1) return ease_inout_back(arg0, 0, 1, 1); else if (arg1 == 1) return -0.5 * cos((pi * arg0) - 1); else if (arg1 == 0) return arg0; arg0 *= 2; if (arg0 < 1) { return 0.5 *
scr_ease_in(arg0, arg1);
} else { arg0--; return 0.5 * (
scr_ease_out(arg0, arg1) + 1);
} }
(timer / targetTime, -1));
61
    if (timer >= targetTime)
62
    {
63
        xx = x + 
scr_orbitx
scr_orbitx

function
scr_orbitx(arg0, arg1, arg2, arg3, arg4)
{ if (arg4 == 0) return arg2; var __theta = point_direction(arg0, arg1, arg2, arg3); var __radius = point_distance(arg0, arg1, arg2, arg3); __theta += arg4; return arg0 + lengthdir_x(__radius, __theta); }
(0, 0, 64 * flip, -20, image_angle);
64
        yy = y + 
scr_orbity
scr_orbity

function
scr_orbity(arg0, arg1, arg2, arg3, arg4)
{ if (arg4 == 0) return arg3; var __theta = point_direction(arg0, arg1, arg2, arg3); var __radius = point_distance(arg0, arg1, arg2, arg3); __theta += arg4; return arg1 + lengthdir_y(__radius, __theta); }
(0, 0, 64 * flip, -20, image_angle);
65
        direction = image_angle + (flip ? 0 : 180);
66
        shootmode = 1;
67
    }
68
}
69
if (shootcon == 0 && shootmode == 1)
70
{
71
    if (global.turntimer >= 40)
72
    {
73
        shootcon = 1;
74
        shoottimer = 0;
75
    }
76
    else
77
    {
78
        shootcon = 5;
79
        shootmode = 0;
80
    }
81
}
82
if (shootcon == 1)
83
{
84
    shootcon = 2;
85
    shoottimer = 0;
86
    shootcount = 0;
87
}
88
if (shootcon == 2)
89
{
90
    shoottimer--;
91
    if (shoottimer <= 0)
92
    {
93
        for (i = 0; i < 3; i += 1)
94
        {
95
            var lasercircle = instance_create(xx, yy, obj_werewire_bullet_lasercircle);
96
            lasercircle.damage = damage;
97
            lasercircle.target = target;
98
            lasercircle.depth = depth - 1;
99
            var laser_angle = direction + random_range(-2, 2);
100
            lasercircle.my_angle = (laser_angle - 5) + (5 * i);
101
            lasercircle.my_angle_change = (-1 + i) * 0.8 * m;
102
            with (lasercircle)
103
            {
104
                my_speed = 4;
105
                my_accel = 0.2;
106
                my_length = 4;
107
            }
108
            lasercircle.my_accel = 0.4;
109
        }
110
        shoottimer = 10 / m;
111
        shootcount += 1;
112
    }
113
    if (shootcount >= 3)
114
    {
115
        shootcon = 5;
116
        shoottimer = 20;
117
    }
118
}
119
if (shootcon == 3)
120
{
121
    bx1[0] = -24;
122
    bx1[1] = -40;
123
    bx1[2] = -48;
124
    bx1[3] = -46;
125
    bx1[4] = -26;
126
    by1[0] = -54;
127
    by1[1] = -30;
128
    by1[2] = 6;
129
    by1[3] = 46;
130
    by1[4] = 72;
131
    bullet_angle = (point_direction(x + bx1[2], y + by1[2], obj_heart.x + 8, obj_heart.y + 8) - 10) + random(20);
132
    shootcon = 4;
133
}
134
if (shootcon == 4)
135
{
136
    shoottimer += 1;
137
    if (shoottimer >= (15 / m))
138
    {
139
        image_index += (0.25 * m);
140
        if (image_index >= 2 && image_index <= 3)
141
        {
142
            repeat (2)
143
            {
144
                if (shootcount < 5)
145
                {
146
                    bullet[shootcount] = instance_create(x + bx1[shootcount], y + by1[shootcount], obj_werewire_bullet_lasersquare);
147
                    bullet[shootcount].damage = global.monsterat[myself] * 5;
148
                    bullet[shootcount].sprite_index = spr_bullet_werewire_spark;
149
                    bullet[shootcount].stretch = 0;
150
                    bullet[shootcount].image_speed = 0.2;
151
                    bullet[shootcount].image_xscale = 4;
152
                    bullet[shootcount].image_yscale = 4;
153
                    bullet[shootcount].direction = (bullet_angle - 28) + (shootcount * 14);
154
                    bullet[shootcount].image_angle = bullet[shootcount].direction;
155
                    bullet[shootcount].speed = 9 - initid - werewerewire;
156
                    bullet[shootcount].friction = 1;
157
                    shootcount += 1;
158
                }
159
            }
160
        }
161
        if (image_index >= 4)
162
        {
163
            for (i = 0; i < 5; i += 1)
164
            {
165
                with (bullet[i])
166
                {
167
                    if (speed <= 0)
168
                        speed = 0.2;
169
                    friction = -0.25;
170
                }
171
            }
172
            shootcon = 0;
173
            image_index = 0;
174
            sprite_index = spr_werewire_idle;
175
            image_speed = 0.16;
176
            stop_anim = 0;
177
        }
178
    }
179
}
180
if (shootcon == 5)
181
{
182
    shoottimer--;
183
    if (shoottimer <= 0)
184
    {
185
        parentwindow.state = 5;
186
        instance_destroy();
187
    }
188
}