Undertale Yellow script viewer

← back to main script listing

gml_Object_obj_compound_parent_Step_0

(view raw script w/o annotations or w/e)
1
if (live_call())
2
    return global.live_result;
3
if (global.sworks_flag[25] == 0 || global.sworks_flag[25] > 1)
4
    exit;
5
var robot_item_x_player = obj_pl.x;
6
var robot_item_y_player = obj_pl.y - 9 - (sprite_height - sprite_yoffset);
7
var nearest_item = 0;
8
with (obj_pl)
9
    nearest_item = instance_nearest(x, y, obj_compound_parent);
10
if (distance_to_point(obj_pl.x, obj_pl.y) < 40 && nearest_item == id && keyboard_multicheck_pressed(0) && obj_pl.state == scr_normal_state)
11
{
12
    if (robot_item_is_carried == false && robot_item_can_pickup == true)
13
    {
14
        with (obj_compound_parent)
15
        {
16
            if (robot_item_is_carried == true)
17
                exit;
18
        }
19
        robot_item_is_jumping = true;
20
        robot_item_x_target = robot_item_x_player;
21
        robot_item_y_target = robot_item_y_player;
22
        audio_play_sound(snd_playerjump, 1, 0);
23
        depth = -9999;
24
        visible = true;
25
        obj_pl.state = scr_frozen_state;
26
        obj_pl.image_index = 0;
27
        obj_pl.image_speed = 0;
28
    }
29
}
30
if (robot_item_is_jumping == true)
31
{
32
    if (scr_arc_jump
scr_arc_jump

function scr_arc_jump(arg0, arg1) { var jump_target_x = arg0; var jump_target_y = arg1; var _xd = jump_target_x - x; var _yd = jump_target_y - y; if (_xd == 0) _xd = 1; gravity = 1.5; var _hsp = (sign(_xd) * sqrt(abs(_xd))) / 1.5; var _time = ceil(_xd / _hsp); hspeed = _xd / _time; vspeed = (_yd / _time) - ((gravity / 2) * (_time + 1)); alarm[0]
gml_Object_obj_compound_parent_Alarm_0.gml

hspeed = 0; vspeed = 0; gravity = 0;
if (round(x) == jump_target_x && round(y) == jump_target_y) { hspeed = 0; vspeed = 0; x = jump_target_x; y = jump_target_y; gravity = 0; return true; } return false; }
(robot_item_x_target, robot_item_y_target))
33
    {
34
        if (robot_item_is_carried == false)
35
        {
36
            robot_item_is_carried = true;
37
            robot_item_is_jumping = false;
38
            if (!global.cutscene)
39
                scr_cutscene_end
scr_cutscene_end

function scr_cutscene_end() { global.cutscene = false; obj_pl.alarm[0] = 1; }
();
40
        }
41
        else if (robot_item_is_carried == true)
42
        {
43
            audio_play_sound(snd_mart_impact_2, 1, 0);
44
            robot_item_is_carried = false;
45
            robot_item_is_jumping = false;
46
            depth = -y;
47
            visible = true;
48
            if (!instance_exists(obj_dialogue))
49
            {
50
                if (!global.cutscene)
51
                    scr_cutscene_end
scr_cutscene_end

function scr_cutscene_end() { global.cutscene = false; obj_pl.alarm[0] = 1; }
();
52
            }
53
            if (instance_exists(obj_steamworks_13_controller) && obj_steamworks_13_controller.robot_part_no_loop == true)
54
                obj_steamworks_13_controller.robot_part_no_loop = false;
55
        }
56
    }
57
    exit;
58
}
59
sprite_set_offset(spr_comp_pepper, 3, -11);
60
if (robot_item_is_carried == true)
61
{
62
    if (keyboard_multicheck(1) && obj_pl.state == scr_normal_state)
63
    {
64
        audio_play_sound(snd_fail, 1, 0);
65
        robot_item_is_carried = false;
66
        x = obj_pl.x;
67
        y = obj_pl.y + robot_item_y_offset;
68
        depth = -y;
69
    }
70
}