Undertale Yellow script viewer

← back to main script listing

gml_Object_obj_swing_interact_Step_0

(view raw script w/o annotations or w/e)
1
if (keyboard_multicheck_pressed(0) && scr_interact
scr_interact

function scr_interact() { if (distance_to_object(obj_pl) < 20 && obj_pl.state == scr_normal_state) { var pl_dir = obj_pl.direction; var pl_x = 0; var pl_y = 0; var check_distance_x = 0; var check_distance_y = 0; switch (pl_dir) { case 0: pl_x = obj_pl.bbox_right; pl_y = obj_pl.bbox_top + 1; check_distance_x = 20; break; case 180: pl_x = obj_pl.bbox_left; pl_y = obj_pl.bbox_top + 1; check_distance_x = -20; break; case 90: pl_x = obj_pl.x; pl_y = obj_pl.bbox_top; check_distance_y = -20; break; case 270: pl_x = obj_pl.x; pl_y = obj_pl.bbox_bottom; check_distance_y = 20; break; } if (collision_line_first(pl_x, pl_y, pl_x + check_distance_x, pl_y + check_distance_y, id, false, false)) return true; } }
())
2
    scene = 1;
3
if (scene == 1)
4
{
5
    scr_text
scr_text

function scr_text() { if (!instance_exists(obj_dialogue)) msg = instance_create(x, y, obj_dialogue); }
();
6
    with (msg)
7
    {
8
        message[0] = "* (It's an empty swing.)";
9
        if (global.route != 3)
10
        {
11
            message[1] = "* (Hop on?)";
12
            ch_msg = 1;
13
            ch[1] = "Yes";
14
            ch[2] = "No";
15
            if (outcome == 1)
16
            {
17
                other.npc_clover = instance_create(obj_pl.x, obj_pl.y, obj_player_npc);
18
                with (other.npc_clover)
19
                {
20
                    x_dest[0] = 479;
21
                    y_dest[0] = 407;
22
                    can_walk = true;
23
                    depth = 0;
24
                }
25
                scr_cutscene_start
scr_cutscene_start

function scr_cutscene_start() { global.cutscene = true; obj_pl.state = scr_frozen_state; obj_pl.image_index = 0; obj_pl.image_speed = 0; }
();
26
                other.scene = 2;
27
            }
28
            if (outcome == 2)
29
            {
30
                other.scene = 0;
31
                global.dialogue_open = false;
32
            }
33
        }
34
        else
35
        {
36
            other.scene = 0;
37
        }
38
    }
39
}
40
if (scene == 2)
41
{
42
    if (npc_clover.npc_arrived == true)
43
    {
44
        npc_clover.action_sprite = true;
45
        npc_clover.sprite_index = spr_pl_run_down;
46
        npc_clover.image_index = 1;
47
        npc_clover.image_speed = 0;
48
        with (npc_clover)
49
            path_start(pt_clover_jump_swing, 2, path_action_stop, false);
50
        audio_play_sound(snd_playerjump, 1, 0);
51
        scene = 3;
52
    }
53
}
54
if (scene > 3 && scene <= 5)
55
    npc_clover.depth = -1000;
56
if (scene == 3)
57
{
58
    alarm[0] = 120;
gml_Object_obj_swing_interact_Alarm_0.gml

if (instance_exists(obj_player_npc)) obj_player_npc.image_speed = 0.2;
59
    with (npc_clover)
60
    {
61
        if (path_position >= 0.5)
62
            depth = -1000;
63
        if (path_position == 1)
64
        {
65
            sprite_index = spr_clover_sitting;
66
            image_index = 0;
67
            image_speed = 0;
68
            audio_sound_gain(obj_radio.current_song, 0, 800);
69
            other.timer = 120;
70
            other.scene++;
71
        }
72
    }
73
}
74
if (scene == 4)
75
{
76
    if (keyboard_multicheck_pressed(0) || keyboard_multicheck_pressed(0))
77
    {
78
        alarm[0] = -1;
gml_Object_obj_swing_interact_Alarm_0.gml

if (instance_exists(obj_player_npc)) obj_player_npc.image_speed = 0.2;
79
        scene++;
80
        npc_clover.sprite_index = spr_pl_run_down;
81
        npc_clover.image_index = 1;
82
        npc_clover.image_speed = 0;
83
        with (npc_clover)
84
            path_start(pt_clover_jump_off_swing, 2, path_action_stop, false);
85
        audio_play_sound(snd_playerjump, 1, 0);
86
    }
87
}
88
if (scene == 5)
89
{
90
    if (npc_clover.path_position == 1)
91
    {
92
        obj_pl.image_alpha = 1;
93
        instance_destroy(npc_clover);
94
        audio_sound_gain(obj_radio.current_song, 1, 800);
95
        timer = 15;
96
        scene++;
97
    }
98
}
99
if (scene == 6)
100
{
101
    if (scr_timer
scr_timer

function scr_timer() { if (timer > 0) { timer--; return false; } else { return true; } }
())
102
    {
103
        scr_cutscene_end
scr_cutscene_end

function scr_cutscene_end() { global.cutscene = false; obj_pl.alarm[0] = 1; }
();
104
        with (obj_kanakofriend)
105
        {
106
            if (npc_flag == 1)
107
                npc_flag = 2;
108
        }
109
        scene = 0;
110
    }
111
}