Deltarune (Chapter 2) script viewer

← back to main script listing

gml_Object_obj_sneo_headwave_Step_0

(view raw script w/o annotations or w/e)
1
if (x >= (camerax() + 900) || x <= (camerax() - 200) || y >= (cameray() + 600) || y <= (cameray() - 200))
2
    instance_destroy();
3
if (init == 0 && image_alpha >= 0.5)
4
{
5
    destroyable = 1;
6
    init = 1;
7
}
8
if (state == 0)
9
{
10
    if (speed <= 0)
11
        state = 1;
12
}
13
else if (state == 1)
14
{
15
    timer++;
16
    if (timer >= 5)
17
    {
18
        timer = 0;
19
        state = 2;
20
        d = instance_create(x, y, obj_regularbullet);
21
        d.direction = point_direction(x, y, obj_heart.x + 4, obj_heart.y + 4);
22
        d.sprite_index = spr_sneo_bullet0;
23
        d.speed = 4;
24
    }
25
}
26
else if (state == 2)
27
{
28
    timer++;
29
    if (timer >= 15)
30
    {
31
        timer = 0;
32
        state = 3;
33
    }
34
}
35
else if (state == 3)
36
{
37
    if (timer == 0)
38
    {
39
        spin += 24;
40
        direction = lerp(180, flydirection, spin / 360);
41
        image_angle = direction + spin + 180;
42
        if (spin >= 360)
43
        {
44
            direction = flydirection;
45
            image_angle = direction + 180;
46
            timer++;
47
        }
48
    }
49
    else
50
    {
51
        timer++;
52
        if (timer >= 10)
53
        {
54
            friction = -0.2;
55
            speed = 0.1;
56
            state = 4;
57
        }
58
    }
59
}
60
else if (state == 4)
61
{
62
    if (speed >= 8)
63
    {
64
        friction = 0;
65
        speed = 8;
66
    }
67
}