Undertale Yellow script viewer

← back to main script listing

gml_Object_obj_dunes_37_couch_Step_0

(view raw script w/o annotations or w/e)
1
switch (scene)
2
{
3
    case 0:
4
        if (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; } }
() && keyboard_multicheck_pressed(0))
5
        {
6
            scene = 1;
7
            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; }
();
8
        }
9
        break;
10
    case 1:
11
        scr_text
scr_text

function scr_text() { if (!instance_exists(obj_dialogue)) msg = instance_create(x, y, obj_dialogue); }
();
12
        with (msg)
13
        {
14
            message[0] = "* (A couch not unfit for a#  thrift store.)";
15
            message[1] = "* (These cramped living#  conditions are bringing back#  unpleasant memories.)";
16
            message[2] = "* (Hop on?)";
17
            ch_msg = 2;
18
            ch[1] = "Yes";
19
            ch[2] = "No";
20
            if (outcome == 1)
21
            {
22
                other.scene = 2;
23
            }
24
            else if (outcome == 2)
25
            {
26
                instance_destroy();
27
                other.scene = 0;
28
                scr_cutscene_end
scr_cutscene_end

function scr_cutscene_end() { global.cutscene = false; obj_pl.alarm[0] = 1; }
();
29
            }
30
        }
31
        break;
32
    case 2:
33
        instance_create(obj_pl.x, obj_pl.y, obj_player_npc);
34
        cutscene_advance();
35
        break;
36
    case 3:
37
        if (obj_player_npc.ystart < y)
38
            cutscene_npc_walk(1168, 200, obj_player_npc.ystart, 3, "y", "up", "nothing", 250, 150);
39
        else
40
            cutscene_npc_walk(1168, 250, 150, 3, "y", "up");
41
        break;
42
    case 4:
43
        cutscene_wait(0.5);
44
        break;
45
    case 5:
46
        tile_layer_hide(-240);
47
        scr_path_jump
scr_path_jump

function scr_path_jump(arg0, arg1, arg2, arg3) { with (arg0) { jump_path = path_add(); path_add_point(jump_path, arg0.x, arg0.y, 100); path_add_point(jump_path, arg1 + (sign(arg0.x - arg1) * min(abs(arg0.x - arg1), 15)), arg2 - arg3, 75); path_add_point(jump_path, arg1, arg2, 100); path_set_kind(jump_path, 1); path_set_closed(jump_path, false); path_start(jump_path, 4, path_action_stop, false); audio_play_sound(snd_playerjump, 1, 0); } }
(1168, 250, 135, 5);
48
        audio_play_sound(snd_playerjump, 1, 0);
49
        cutscene_advance();
50
        break;
51
    case 6:
52
        with (obj_player_npc)
53
        {
54
            if (scr_path_jump_end
scr_path_jump_end

function scr_path_jump_end() { if (path_position >= 1) { path_delete(jump_path); return true; } return false; }
())
55
            {
56
                action_sprite = true;
57
                sprite_index = right_sprite_idle;
58
                image_angle += 90;
59
                other.scene++;
60
            }
61
        }
62
        if (!alarm[0])
63
            alarm[0] = 75;
gml_Object_obj_dunes_37_couch_Alarm_0.gml

with (obj_player_npc) { sprite_index = spr_pl_lying; image_angle = 0; } alarm[1] = 1;
64
        break;
65
    case 7:
66
        if (global.down_keyp || global.up_keyp || global.left_keyp || global.right_keyp || keyboard_multicheck_pressed(0) || keyboard_multicheck_pressed(1) || keyboard_multicheck_pressed(2))
67
        {
68
            alarm[0] = -1;
gml_Object_obj_dunes_37_couch_Alarm_0.gml

with (obj_player_npc) { sprite_index = spr_pl_lying; image_angle = 0; } alarm[1] = 1;
69
            alarm[1] = -1;
gml_Object_obj_dunes_37_couch_Alarm_1.gml

instance_create(obj_player_npc.x - 3, obj_player_npc.y - 15, obj_npc_sleepo_z); alarm[0] = 50;
70
            cutscene_advance();
71
        }
72
        break;
73
    case 8:
74
        with (obj_player_npc)
75
        {
76
            sprite_index = down_sprite;
77
            image_index = 1;
78
            image_speed = 0;
79
            image_angle = 0;
80
        }
81
        scr_path_jump
scr_path_jump

function scr_path_jump(arg0, arg1, arg2, arg3) { with (arg0) { jump_path = path_add(); path_add_point(jump_path, arg0.x, arg0.y, 100); path_add_point(jump_path, arg1 + (sign(arg0.x - arg1) * min(abs(arg0.x - arg1), 15)), arg2 - arg3, 75); path_add_point(jump_path, arg1, arg2, 100); path_set_kind(jump_path, 1); path_set_closed(jump_path, false); path_start(jump_path, 4, path_action_stop, false); audio_play_sound(snd_playerjump, 1, 0); } }
(1168, 250, 150, 4);
82
        audio_play_sound(snd_playerjump, 1, 0);
83
        cutscene_advance();
84
        break;
85
    case 9:
86
        with (obj_player_npc)
87
        {
88
            if (scr_path_jump_end
scr_path_jump_end

function scr_path_jump_end() { if (path_position >= 1) { path_delete(jump_path); return true; } return false; }
())
89
            {
90
                instance_destroy();
91
                other.scene = 0;
92
                scr_cutscene_end
scr_cutscene_end

function scr_cutscene_end() { global.cutscene = false; obj_pl.alarm[0] = 1; }
();
93
            }
94
        }
95
        tile_layer_show(-240);
96
        break;
97
}