Deltarune (Chapter 2) script viewer

← back to main script listing

gml_Object_obj_queen_search_flail_Step_0

(view raw script w/o annotations or w/e)
1
flip = 1;
2
if (broken > 0)
3
{
4
    if (broken == 1)
5
    {
6
        direction = 
scr_getlaunchdirection
scr_getlaunchdirection

function
scr_getlaunchdirection(arg0, arg1, arg2, arg3)
{ if ((sqr(arg0) / arg2) <= arg1) return 45; var __resultangle = radtodeg(arcsin((arg1 * arg2) / sqr(arg0))) / 2; if (arg3 >= 1) return 90 - __resultangle; else if (arg3 <= -1) return __resultangle; else return choose(__resultangle, 90 - __resultangle); }
(18, 636 - x, 0.75, 1);
7
        speed = 18;
8
        gravity = 0.75;
9
        var chaindirection = point_direction(xstart, ystart, x, y);
10
        for (i = 0; i < 4; i++)
11
        {
12
            xx = lerp(xstart, x, i / 4);
13
            yy = lerp(ystart, y, i / 4);
14
            d = instance_create(xx, yy, obj_afterimage);
15
            d.direction = chaindirection + (flip * -90) + random_range(-15, 15);
16
            d.gravity = 0.75;
17
            d.speed = random_range(2, 15);
18
            d.sprite_index = sprite_index;
19
            d.image_speed = 0;
20
            d.image_index = 1;
21
            d.depth = depth;
22
        }
23
        broken = 2;
24
    }
25
    exit;
26
}
27
if (hitstun > 0)
28
{
29
    hitstun--;
30
    exit;
31
}
32
if (bufferstate == 0 && 
scr_queen_buffercheck
scr_queen_buffercheck

function
scr_queen_buffercheck()
{ return instance_exists(obj_queen_buffercontroller) && obj_queen_buffercontroller.buffering == 1; }
())
33
{
34
    image_blend = c_gray;
35
    bufferstate = 1;
36
}
37
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; }
())
38
{
39
    image_blend = c_white;
40
    bufferstate = 2;
41
}
42
if (bufferstate == 1)
43
    exit;
44
if (loading > 0)
45
    exit;
46
if (chainlength < 40)
47
    chainlength++;
48
var _chainlength = min(30, chainlength);
49
if (lengthtimer < (maxchainlength - 40) && lengthstate == 0)
50
    lengthtimer += 2;
51
else
52
    lengthstate = 1;
53
if (lengthstate == 1)
54
    lengthtimer -= 1;
55
if (timer < 400)
56
{
57
    
scr_orbitaroundpoint_dx
scr_orbitaroundpoint_dx

function
scr_orbitaroundpoint_dx(arg0, arg1, arg2, arg3)
{ x = arg0 + lengthdir_x(arg2, arg3); y = arg1 + lengthdir_y(arg2, arg3); }
(xstart, ystart, min((lengthtimer * 2) + _chainlength, maxchainlength), (rotateposition * 8 * flip) + direction);
58
}
59
else
60
{
61
    parentwindow.state = 5;
62
    impact = 1;
63
    instance_destroy();
64
}
65
if (timer >= 400 && impact == 0)
66
{
67
    timer = 164.6;
68
    var rotate_speed = timer;
69
    if (rotate_speed > 40)
70
        rotate_speed = 40;
71
    
scr_orbitaroundpoint_dx
scr_orbitaroundpoint_dx

function
scr_orbitaroundpoint_dx(arg0, arg1, arg2, arg3)
{ x = arg0 + lengthdir_x(arg2, arg3); y = arg1 + lengthdir_y(arg2, arg3); }
(xstart, ystart, min((lengthtimer * 2) + _chainlength, maxchainlength), (rotateposition * 8 * flip) + direction);
72
    d = instance_exists(obj_shake) ? 196 : instance_create(0, 0, obj_shake);
73
    d.shakex = ceil(2);
74
    d.shakey = ceil(2);
75
    snd_play(snd_screenshake);
76
    for (i = 0; i < 4; i++)
77
    {
78
        d = instance_create(x, y, obj_regularbullet);
79
        d.sprite_index = spr_spadebullet;
80
        d.updateimageangle = 1;
81
        d.gravity = 0.75;
82
        d.direction = 90 + (flip * (-25 + (i * 10) + irandom(10)));
83
        d.speed = 20;
84
    }
85
    impact = 1;
86
}
87
timer += 2;
88
rotateposition += 0.5;
89
bufferstate = 0;