Deltarune (Chapter 4) script viewer

← back to main script listing

gml_Object_obj_dw_churchb_windows_Step_2

(view raw script w/o annotations or w/e)
1
var targcount = 16;
2
targcount = 8;
3
var resetNPCs = false;
4
if (loopactive == 1)
5
{
6
    var offset = abs(rightx - leftx);
7
    if (kris.x > rightx)
8
    {
9
        loopcount++;
10
        resetNPCs = true;
11
        if (loopcount == 1)
12
        {
13
            with (npc[0])
14
            {
15
                setxy(xstart, ystart);
16
                dontreset = true;
17
            }
18
        }
19
        if (loopcount == 4)
20
        {
21
            with (npc[1])
22
            {
23
                setxy(xstart, ystart);
24
                dontreset = true;
25
            }
26
        }
27
        if (loopcount == 5)
28
        {
29
            with (npc[2])
30
            {
31
                setxy(xstart, ystart);
32
                dontreset = true;
33
            }
34
        }
35
        if (loopcount == 7)
36
        {
37
            with (npc[3])
38
            {
39
                setxy(xstart, ystart);
40
                dontreset = true;
41
            }
42
        }
43
        if (loopcount < targcount)
44
        {
45
            debug_message("LOOP" + string(loopcount));
46
            kris.x -= offset;
47
            with (obj_caterpillarchara)
48
            {
49
                for (var i = 0; i < array_length(remx); i++)
50
                    remx[i] -= offset;
51
            }
52
        }
53
        else
54
        {
55
            loopactive = 2;
56
        }
57
    }
58
    if (loopcount > 0)
59
    {
60
        if (kris.x < leftx)
61
        {
62
            debug_message("LOOP" + string(loopcount));
63
            loopcount = 0;
64
            resetNPCs = true;
65
        }
66
    }
67
}
68
if (loopactive == 2)
69
{
70
    if (kris.x > goback1)
71
    {
72
        debug_message("LOOP" + string(loopcount));
73
        loopactive = 3;
74
    }
75
    if (kris.x < rightx)
76
    {
77
        loopactive = 1;
78
        loopcount = 0;
79
        resetNPCs = true;
80
        debug_message("LOOP" + string(loopcount));
81
    }
82
}
83
if (loopactive == 3)
84
{
85
    if (kris.x < goback1)
86
    {
87
        var offset = abs(goback1 - rightx);
88
        kris.x -= offset;
89
        with (obj_caterpillarchara)
90
        {
91
            for (var i = 0; i < array_length(remx); i++)
92
                remx[i] -= offset;
93
        }
94
        loopactive = 1;
95
        loopcount = 0;
96
        resetNPCs = true;
97
    }
98
    if (kris.x > goback2)
99
        loopactive = 4;
100
}
101
if (loopactive == 4)
102
{
103
    if (kris.x < goback2)
104
    {
105
        var offset = abs(goback2 - rightx);
106
        kris.x -= offset;
107
        with (obj_caterpillarchara)
108
        {
109
            for (var i = 0; i < array_length(remx); i++)
110
                remx[i] -= offset;
111
        }
112
        resetNPCs = true;
113
        loopactive = 1;
114
        loopcount = 0;
115
    }
116
}
117
if (resetNPCs)
118
{
119
    for (var i = 0; i < array_length(npc); i++)
120
    {
121
        with (npc[i])
122
        {
123
            if (!dontreset)
124
                y = -200;
125
            dontreset = false;
126
        }
127
    }
128
}