Deltarune (Chapter 2) script viewer

← back to main script listing

gml_Object_obj_ow_enemy_virovirokun_Step_0

(view raw script w/o annotations or w/e)
1
gentimer += 1;
2
if (con == 0)
3
{
4
    if (obj_mainchara.x >= 360)
5
    {
6
        con = 1;
7
        shottimer = 0;
8
        hspeed = choose(4, 6, 7);
9
    }
10
}
11
if (con == 1)
12
{
13
    timer += 1;
14
    if (x >= ((camerax() + 640) - 60) && hspeed > 0)
15
        hspeed = -hspeed;
16
    if (x <= camerax() && hspeed < 0)
17
        hspeed = -hspeed;
18
    if (timer >= timermax)
19
    {
20
        shotcount += 1;
21
        hspeed = choose(4, 6, 7);
22
        hspeed = clamp(hspeed, -7, 7);
23
        if (obj_mainchara.x < x)
24
            hspeed *= (-1 * multiplier);
25
        spear = instance_create(x + (sprite_width / 2) + (hspeed * 4), y + 65, obj_virospear);
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
        if (i_ex(spear))
32
            spear.direction += random(15) - random(15);
33
        if (i_ex(spear))
34
            spear.image_angle = spear.direction;
35
        if (i_ex(spear))
36
            spear.depth = depth - 20;
37
        timer = 0;
38
        timermax = choose(16, 22, 26);
39
        vspeed = (-sin(gentimer / 12) * 12.5) / 10;
40
        if (obj_mainchara.x >= battleEndPos)
41
        {
42
            con = 2;
43
            shottimer = 0;
44
            y = floor(y);
45
            x = floor(x);
46
        }
47
    }
48
}
49
if (con == 2)
50
{
51
    hspeed *= 9;
52
    if (hspeed > -0.1)
53
        hspeed = 0;
54
    if (hspeed < 0.1)
55
        hspeed = 0;
56
    if (y > 142)
57
        y -= 2;
58
    if (x > 1560)
59
        x -= 2;
60
    if (y <= 142)
61
    {
62
        y = 142;
63
        hspeed = 0;
64
        vspeed = 0;
65
    }
66
    if (y <= 142 && obj_mainchara.y < 360)
67
        con = 3;
68
}
69
if (con == 3)
70
{
71
    if (y < 156)
72
        y += 2;
73
    if (x > 1560)
74
        x -= 2;
75
    if (y >= 156)
76
    {
77
        sprite_index = spr_virovirokun_hurt;
78
        y = 156;
79
        con = 4;
80
    }
81
}
82
if (con == 4)
83
{
84
    x -= 2;
85
    if ((x + nottooclose) > obj_mainchara.x)
86
    {
87
        nottooclose -= 0.5;
88
        nottooclose = clamp(nottooclose, 10, 999);
89
        x = obj_mainchara.x - nottooclose;
90
    }
91
    if (x <= 180)
92
        con = 5;
93
}
94
if (con == 5)
95
{
96
    tenemy1 = instance_create(x, y, obj_chaseenemy);
97
    with (tenemy1)
98
    {
99
        myencounter = 55;
100
        sprite_index = spr_virovirokun_idle;
101
        touchsprite = spr_virovirokun_hurt;
102
        radius = 1;
103
        moveradius = 0;
104
        pacetype = 9;
105
        chasetype = 3;
106
        alertskip = 1;
107
        ignoresolid = 0;
108
    }
109
    instance_destroy();
110
}