Deltarune (Chapter 2) script viewer

← back to main script listing

gml_Object_obj_shapepuzzlebutton_Step_0

(view raw script w/o annotations or w/e)
1
if (mybuffer < 10)
2
    mybuffer++;
3
if (mybuffer > 2)
4
{
5
    if (active && bird >= 0)
6
    {
7
        if (button2_p() || obj_shapepuzzle.goalHit)
8
        {
9
            snd_play(snd_wing);
10
            with (obj_shapepuzzle)
11
                inUse = false;
12
            active = false;
13
            image_index = 0;
14
            global.interact = obj_shapepuzzle.goalHit;
15
            global.facing = 0;
16
            with (myPiece)
17
                active = false;
18
            exit;
19
        }
20
        if (button1_p())
21
        {
22
            snd_play_pitch(snd_item, 1.5);
23
            with (myPiece)
24
            {
25
                if (other.troublePiece && image_angle == -90)
26
                {
27
                    image_angle += 90;
28
                    x -= lengthdir_x(sprite_width, image_angle);
29
                    y -= lengthdir_y(sprite_width, image_angle);
30
                }
31
                else
32
                {
33
                    image_angle -= 90;
34
                    x += lengthdir_x(sprite_width, image_angle + 90);
35
                    y += lengthdir_y(sprite_width, image_angle + 90);
36
                }
37
            }
38
            with (obj_shapepuzzle)
39
                goalCheck = true;
40
        }
41
        var _moveH = right_h() - left_h();
42
        var _moveV = down_h() - up_h();
43
        with (myPiece)
44
        {
45
            var _centerLength = sprite_width * (sqrt(2) / 2);
46
            if ((x + lengthdir_x(_centerLength, image_angle - 45) + (_moveH * other.moveAmount)) < 0 || (x + lengthdir_x(_centerLength, image_angle - 45) + (_moveH * other.moveAmount)) > 640)
47
                _moveH = 0;
48
            if ((y + lengthdir_y(_centerLength, image_angle - 45) + (_moveV * other.moveAmount)) < 200 || (y + lengthdir_y(_centerLength, image_angle - 45) + (_moveV * other.moveAmount)) > 480)
49
                _moveV = 0;
50
        }
51
        var _moveDir = point_direction(0, 0, _moveH, _moveV);
52
        if (_moveH == 0 && _moveV == 0)
53
        {
54
            holdDelay = 0;
55
            image_index = 0;
56
        }
57
        else
58
        {
59
            image_index = min(1 + round(_moveDir / 90), 4);
60
            if (--holdDelay <= 0)
61
            {
62
                snd_play_pitch(snd_menumove, 1.5);
63
                holdDelay = holdDelayMax;
64
                with (myPiece)
65
                {
66
                    x += (_moveH * other.moveAmount);
67
                    y += (_moveV * other.moveAmount);
68
                    if (other.bird > 0)
69
                    {
70
                        var pieceCenterLen = point_distance(0, 0, sprite_width / 2, sprite_height / 2);
71
                        var pieceCenterDir = point_direction(0, 0, sprite_width / 2, sprite_height / 2);
72
                        var _xx = x + lengthdir_x(pieceCenterLen, pieceCenterDir + image_angle);
73
                        var _yy = y + lengthdir_y(pieceCenterLen, pieceCenterDir + image_angle);
74
                        if (_xx >= 530 && _xx <= 610 && _yy >= 255 && _yy <= 315)
75
                            other.bird = 2;
76
                        else
77
                            other.bird = 1;
78
                    }
79
                }
80
                with (obj_shapepuzzle)
81
                    goalCheck = true;
82
            }
83
        }
84
    }
85
    else if (obj_shapepuzzle.goalHit)
86
    {
87
        if (image_index < 5)
88
            image_index = 5;
89
        else if (image_index < 8)
90
            image_index += 0.5;
91
    }
92
    if (bird == 2 && active)
93
    {
94
        berdly_taunt_timer++;
95
        if (berdly_taunt_timer >= 15)
96
        {
97
            image_index = 0;
98
            bird = -1;
99
            active = false;
100
            global.facing = 0;
101
            
scr_speaker
scr_speaker

function
scr_speaker(arg0)
{ _speaker = arg0; global.typer = 5; if (global.darkzone == 1) global.typer = 6; if (global.fighting == 1) global.typer = 4; global.fc = 0; global.fe = 0; if (_speaker == "silent" && global.darkzone == 0) global.typer = 2; if (_speaker == "silent" && global.darkzone == 1) global.typer = 36; if (_speaker == "balloon" || _speaker == "enemy") global.typer = 50; if (_speaker == "sans") { global.typer = 14; global.fc = 6; } if (_speaker == "undyne" || _speaker == "und") { global.typer = 17; global.fc = 9; } if (_speaker == "temmie" || _speaker == "tem") global.typer = 21; if (_speaker == "jevil") global.typer = 35; if (_speaker == "catti") global.fc = 13; if (_speaker == "jockington" || _speaker == "joc") global.fc = 14; if (_speaker == "catty" || _speaker == "caddy") global.fc = 16; if (_speaker == "bratty" || _speaker == "bra") global.fc = 17; if (_speaker == "rouxls" || _speaker == "rou") global.fc = 18; if (_speaker == "burgerpants" || _speaker == "bur") global.fc = 19; if (_speaker == "spamton") { if (global.fighting == 0) global.typer = 66; else global.typer = 68; } if (_speaker == "sneo") global.typer = 67; if (_speaker == "susie" || _speaker == "sus") { global.fc = 1; global.typer = 10; if (global.darkzone == 1) { global.typer = 30; if (global.fighting == 1) global.typer = 47; } } if (_speaker == "ralsei" || _speaker == "ral") { global.fc = 2; global.typer = 31; if (global.fighting == 1) global.typer = 45; if (global.flag[30 ralsei_hat_state] == 1) global.typer = 6; } if (_speaker == "noelle" || _speaker == "noe") { global.fc = 3; if (global.darkzone == 0) global.typer = 12; else global.typer = 56; if (global.fighting == 1) global.typer = 59; } if (_speaker == "toriel" || _speaker == "tor") { global.fc = 4; global.typer = 7; } if (_speaker == "asgore" || _speaker == "asg") { global.fc = 10; global.typer = 18; } if (_speaker == "king" || _speaker == "kin") { global.fc = 20; global.typer = 33; if (global.chapter == 1) { if (global.plot < 235) global.typer = 36; } if (global.fighting == 1) ...
("berdly");
102
            msgsetloc(0, 
Face B* Kris! Delay 11Stop taunting me with that appealing blue shape!Wait for input
"\\EB* Kris!^1 Stop taunting me with that appealing blue shape!/", "obj_shapepuzzlebutton_slash_Step_0_gml_101_0"
);
103
            msgnextloc(
Face C* Y-Delay 11You're just lucky this isn't online, Delay 11or... Delay 11or...Wait for input
"\\EC* Y^1-You're just lucky this isn't online,^1 or...^1 or.../", "obj_shapepuzzlebutton_slash_Step_0_gml_102_0"
);
104
            msgnextloc(
Face D* ... or you wouldn't be able to taunt!!Wait for inputClose Message
"\\ED* ... or you wouldn't be able to taunt!!/%", "obj_shapepuzzlebutton_slash_Step_0_gml_103_0"
);
105
            var d = d_make();
106
            d.side = 1;
107
        }
108
    }
109
    if (bird == -1 && !instance_exists(obj_dialoguer))
110
    {
111
        active = true;
112
        global.facing = 2;
113
        bird = 0;
114
    }
115
}