Deltarune (Chapter 3) script viewer

← back to main script listing

gml_Object_obj_ch3_PGS01B_eyepuzzle_Step_0

(view raw script w/o annotations or w/e)
1
if (!puzzle_ready)
2
{
3
    if (obj_mainchara.sliding == 1)
4
        exit;
5
    var sliding = false;
6
    with (obj_caterpillarchara)
7
        sliding = slided == 1;
8
    if (sliding)
9
        exit;
10
    if (obj_mainchara.y >= 2760)
11
    {
12
        if (obj_mainchara.x >= 1100)
13
        {
14
            puzzle_ready = true;
15
            stop_follow = true;
16
        }
17
    }
18
}
19
else
20
{
21
    if (set_puzzle)
22
    {
23
        set_puzzle = false;
24
        with (eyemarker[0])
25
            image_index = 1;
26
        with (eyemarker[2])
27
            image_index = 1;
28
        with (obj_caterpillarchara)
29
        {
30
            follow = 0;
31
            fun = 1;
32
            sprite_index = dsprite;
33
            if (name == "ralsei")
34
            {
35
                x = 1520;
36
                y = (2800 - sprite_get_height(sprite_index)) + 20;
37
            }
38
            else if (name == "susie")
39
            {
40
                x = 1240;
41
                y = (2800 - sprite_get_height(sprite_index)) + 20;
42
            }
43
        }
44
    }
45
    if (stop_follow)
46
    {
47
        stop_follow = false;
48
        global.pause_follow = true;
49
        with (obj_caterpillarchara)
50
        {
51
            follow = 0;
52
            fun = 1;
53
            image_index = 0;
54
        }
55
    }
56
    if (!susie_solve || !ralsei_solve)
57
    {
58
        var solve_susie = susie_solve;
59
        var solve_ralsei = ralsei_solve;
60
        with (obj_caterpillarchara)
61
        {
62
            if (name == "susie" && !solve_susie)
63
            {
64
                if (point_distance(x, y, 1240, (2800 - sprite_get_height(sprite_index)) + 16) < 5)
65
                {
66
                    image_speed = 0;
67
                    image_index = 0;
68
                    sprite_index = spr_susie_up_press;
69
                    solve_susie = true;
70
                }
71
                else
72
                {
73
                    sprite_index = rsprite;
74
                    image_speed = 0.3;
75
                }
76
                scr_obj_movetowards_point(1240, (2800 - sprite_get_height(sprite_index)) + 16, 16);
77
            }
78
            if (name == "ralsei" && !solve_ralsei)
79
            {
80
                if (point_distance(x, y, 1520, (2800 - sprite_get_height(sprite_index)) + 20) < 5)
81
                {
82
                    image_speed = 0;
83
                    image_index = 0;
84
                    sprite_index = spr_ralsei_up_press;
85
                    solve_ralsei = true;
86
                }
87
                else
88
                {
89
                    sprite_index = rsprite;
90
                    image_speed = 0.4;
91
                }
92
                scr_obj_movetowards_point(1520, (2800 - sprite_get_height(sprite_index)) + 20, 14);
93
            }
94
        }
95
        susie_solve = solve_susie;
96
        ralsei_solve = solve_ralsei;
97
    }
98
    if (susie_solve && !susie_press)
99
    {
100
        susie_press_timer++;
101
        if (susie_press_timer == 1)
102
            sound_play(snd_noise);
103
        if (susie_press_timer == 4)
104
        {
105
            with (eyemarker[0])
106
                image_index = 1;
107
        }
108
        if (susie_press_timer == 8)
109
        {
110
            susie_press = true;
111
            with (obj_caterpillarchara)
112
            {
113
                if (name == "susie")
114
                    sprite_index = dsprite;
115
            }
116
        }
117
    }
118
    if (ralsei_solve && !ralsei_press)
119
    {
120
        ralsei_press_timer++;
121
        if (ralsei_press_timer == 1)
122
            sound_play(snd_noise);
123
        if (ralsei_press_timer == 4)
124
        {
125
            with (eyemarker[2])
126
                image_index = 1;
127
        }
128
        if (ralsei_press_timer == 8)
129
        {
130
            ralsei_press = true;
131
            with (obj_caterpillarchara)
132
            {
133
                if (name == "ralsei")
134
                    sprite_index = dsprite;
135
            }
136
        }
137
    }
138
}
139
if (kris_press)
140
{
141
    kris_press_timer++;
142
    if (kris_press_timer == 1)
143
    {
144
        global.interact = 1;
145
        sound_play(snd_noise);
146
    }
147
    if (kris_press_timer == 4)
148
    {
149
        with (eyemarker[1])
150
            image_index = 1;
151
    }
152
    if (kris_press_timer == 20)
153
    {
154
        clean_up();
155
        sound_play(snd_impact);
156
        
scr_shakescreen
scr_shakescreen

function
scr_shakescreen()
{ instance_create(x, y, obj_shake); }
();
157
        layer_set_visible("ASSETS_Magical_Glass", true);
158
        for (var i = 0; i < array_length(eyesparkle); i++)
159
        {
160
            with (eyesparkle[i])
161
                visible = 0;
162
        }
163
        with (bridge_collider)
164
            instance_destroy();
165
    }
166
    if (kris_press_timer == 35)
167
    {
168
        kris_press = false;
169
        global.pause_follow = false;
170
        with (obj_ch3_PGS01B_eyepuzzle_switch)
171
            instance_destroy();
172
        global.interact = 0;
173
        global.facing = 0;
174
        with (obj_caterpillarchara)
175
        {
176
            fun = 0;
177
            follow = 1;
178
            
scr_caterpillar_interpolate
scr_caterpillar_interpolate

function
scr_caterpillar_interpolate()
{ _newfacing =
scr_facing_letter_to_number(
scr_get_cardinal_direction(point_direction(x, y, obj_mainchara.x, obj_mainchara.y)));
remx[0] = obj_mainchara.x; remy[0] = obj_mainchara.y; facing[0] = _newfacing; for (_iaia = target; _iaia > 0; _iaia -= 1) { remx[_iaia] = lerp(obj_mainchara.x, x, _iaia / target); if (global.darkzone == 1) remy[_iaia] = lerp(obj_mainchara.y, y + 16, _iaia / target); else remy[_iaia] = lerp(obj_mainchara.y, y + 6, _iaia / target); facing[_iaia] = _newfacing; } }
();
179
        }
180
        global.plot = 21;
181
    }
182
}