Deltarune (Chapter 2) script viewer

← back to main script listing

gml_Object_obj_ow_virokun_mansion_east_1f_d_Step_0

(view raw script w/o annotations or w/e)
1
gentimer += 1;
2
if (con == 0)
3
{
4
    y += 16;
5
    x += 4;
6
    if (y >= 128)
7
        con = 1;
8
}
9
if (con == 1)
10
{
11
    timer += 1;
12
    if (x >= ((camerax() + 640) - 60) && hspeed > 0)
13
        hspeed = -hspeed;
14
    if (x <= camerax() && hspeed < 0)
15
        hspeed = -hspeed;
16
    if (timer >= timermax)
17
    {
18
        shotcount += 1;
19
        hspeed = choose(4, 6, 7);
20
        hspeed = clamp(hspeed, -7, 7);
21
        if (obj_mainchara.x < x)
22
            hspeed *= (-1 * multiplier);
23
        spear = instance_create(x + (sprite_width / 2) + (hspeed * 4), y + 65, obj_virospear);
24
        if (instance_exists(obj_mainchara))
25
        {
26
            if (obj_mainchara.x != obj_mainchara.xprevious)
27
            {
28
                if (i_ex(spear))
29
                    spear.hspeed += (obj_mainchara.x - obj_mainchara.xprevious) / 8;
30
            }
31
        }
32
        if (i_ex(spear))
33
            spear.direction += random(15) - random(15);
34
        if (i_ex(spear))
35
            spear.image_angle = spear.direction;
36
        if (i_ex(spear))
37
            spear.depth = depth - 20;
38
        timer = 0;
39
        timermax = choose(16, 22, 26);
40
        vspeed = (-sin(gentimer / 12) * 12.5) / 10;
41
    }
42
}
43
if (con == 1.5)
44
{
45
    newtimer = 0;
46
    speed = 0;
47
    hspeed = 0;
48
    vspeed = 0;
49
    global.interact = 1;
50
    scr_depth
scr_depth

function scr_depth() { depth = 100000 - ((y * 10) + (sprite_height * 10)); }
();
51
    con = 2;
52
}
53
if (con == 2)
54
{
55
    newtimer++;
56
    if (newtimer == 45)
57
        con = 3;
58
    global.interact = 1;
59
    scr_depth
scr_depth

function scr_depth() { depth = 100000 - ((y * 10) + (sprite_height * 10)); }
();
60
}
61
if (con == 3)
62
{
63
    scr_depth
scr_depth

function scr_depth() { depth = 100000 - ((y * 10) + (sprite_height * 10)); }
();
64
    global.interact = 1;
65
    sprite_index = spr_virovirokun_hurt;
66
    move_towards_point(room_width / 2, -128, 12);
67
    if (y <= -128)
68
    {
69
        global.flag[354 bagels_purchased] = 1;
70
        snd_play(snd_impact);
71
        instance_create(0, 0, obj_shake);
72
        global.interact = 0;
73
        instance_destroy();
74
    }
75
}