Deltarune (Chapter 4) script viewer

← back to main script listing

gml_Object_obj_overworld_knight_sword_manager_Step_0

(view raw script w/o annotations or w/e)
1
timer++;
2
if (con == 0)
3
{
4
    if (obj_mainchara.y < 3660)
5
    {
6
        with (obj_church_wind_effect)
7
            con = 1;
8
    }
9
    else
10
    {
11
        with (obj_church_wind_effect)
12
            con = 0;
13
        with (obj_dw_windy_char)
14
            top_anim_speed = 0;
15
    }
16
    timer++;
17
    if (timer >= timermax && obj_mainchara.y < 3660)
18
    {
19
        if (timermax < 11 && patterncount >= 15)
20
        {
21
            if (irandom(100) < 50)
22
            {
23
                inst = instance_create((camerax() + 320) - 70, cameray() + 90, obj_overworld_knight_sword1);
24
                inst.ypos = 90;
25
                inst = instance_create((camerax() + 320) - 30, cameray() + 90, obj_overworld_knight_sword1);
26
                inst.ypos = 90;
27
                inst = instance_create(camerax() + 320 + 10, cameray() + 90, obj_overworld_knight_sword1);
28
                inst.ypos = 90;
29
            }
30
            else
31
            {
32
                inst = instance_create(camerax() + 320 + 70, cameray() + 90, obj_overworld_knight_sword1);
33
                inst.ypos = 90;
34
                inst = instance_create(camerax() + 320 + 30, cameray() + 90, obj_overworld_knight_sword1);
35
                inst.ypos = 90;
36
                inst = instance_create((camerax() + 320) - 10, cameray() + 90, obj_overworld_knight_sword1);
37
                inst.ypos = 90;
38
            }
39
            patterncount = 0;
40
            timer = -18;
41
        }
42
        else
43
        {
44
            inst = instance_create(((camerax() + 320) - 80) + irandom(160), cameray() + 90, obj_overworld_knight_sword1);
45
            inst.ypos = 90;
46
            swordcount++;
47
            patterncount += (1 + random(1));
48
            if (swordcount == 3 || irandom(100) < 50)
49
            {
50
                inst.x = obj_mainchara.x + 20;
51
                swordcount = 0;
52
            }
53
            timer = 0;
54
            if (timermax > 25)
55
                timermax -= 5;
56
            else if (timermax > 10)
57
                timermax -= 1;
58
            if (patterncount >= 15 && timermax < 11)
59
                timer = -20;
60
        }
61
    }
62
}
63
if (room == room_dw_church_staircase)
64
{
65
    with (obj_mainchara)
66
    {
67
        if (alarm[1] > 0 && !place_meeting(x, y + 1, obj_solidblock))
68
            y += 3;
69
    }
70
}