Undertale Yellow script viewer

← back to main script listing

gml_Object_obj_factory_02_conveyor_item_Step_0

(view raw script w/o annotations or w/e)
1
if live_call()
2
    return global.live_result;
3
if (destroy_self > 0)
4
{
5
    if (stage == 3)
6
    {
7
        obj_ceroba_npc.npc_direction = "right"
8
        obj_ceroba_npc.action_sprite = false
9
    }
10
    if (destroy_self == 1)
11
    {
12
        vspeed = -3
13
        gravity = 0.25
14
        destroy_self = 2
15
    }
16
    else
17
    {
18
        if (image_alpha <= 0)
19
            instance_destroy()
20
        image_angle += 10
21
        image_alpha -= 0.1
22
    }
23
    return;
24
}
25
switch stage
26
{
27
    case 0:
28
        if (x <= 395)
29
        {
30
            gravity = 0.2
31
            if (vspeed > vspeed_max)
32
                vspeed = vspeed_max
33
            if (y >= 610)
34
            {
35
                vspeed_old = 0
36
                vspeed = 0
37
                gravity = 0
38
                y = 610
39
                audio_play_sound(choose(423, 424, 425), 1, 0)
40
                stage++
41
            }
42
        }
43
        break
44
    case 1:
45
        if ((item_type == "trash" && item_wrap == false) || item_wrap == false)
46
        {
47
            if (x <= 235)
48
            {
49
                depth = -1000
50
                gravity = 0.2
51
                if (vspeed > vspeed_max)
52
                    vspeed = vspeed_max
53
                if (y >= 620)
54
                {
55
                    audio_play_sound(choose(423, 424, 425), 1, 0)
56
                    hspeed = 0
57
                    vspeed = -3
58
                    if (item_type != "trash")
59
                    {
60
                        obj_factory_02_conveyor_puzzle.conveyor_item_number_wrong -= 1
61
                        audio_play_sound(snd_fail, 1, 0)
62
                    }
63
                    y = 620
64
                    stage++
65
                }
66
            }
67
        }
68
        else if (x <= 240)
69
        {
70
            if instance_exists(obj_ceroba_npc)
71
            {
72
                if (obj_ceroba_npc.action_sprite == true)
73
                {
74
                    with (obj_factory_02_conveyor_item)
75
                        hspeed = 0
76
                    obj_conveyor_belt.image_speed = 0
77
                    return;
78
                }
79
                with (obj_factory_02_conveyor_item)
80
                    hspeed = (-hsp_base)
81
                obj_conveyor_belt.image_speed = 1
82
                hspeed = 0
83
                image_alpha = 0
84
                obj_ceroba_npc.action_sprite = true
85
                obj_ceroba_npc.image_speed = 1
86
                if (sprite_index == spr_conveyor_items_red_wrapped)
87
                    obj_ceroba_npc.sprite_index = spr_conveyor_ceroba_throw_red
88
                else
89
                    obj_ceroba_npc.sprite_index = spr_conveyor_ceroba_throw_blue
90
                obj_ceroba_npc.image_index = 0
91
                stage = 3
92
            }
93
        }
94
        break
95
    case 2:
96
        if (image_alpha <= 0)
97
            instance_destroy()
98
        image_angle += 10
99
        image_alpha -= 0.1
100
        break
101
    case 3:
102
        if (obj_ceroba_npc.image_index >= 9 && item_throw_noloop == false)
103
        {
104
            x = obj_ceroba_npc.x - 10
105
            y = obj_ceroba_npc.y
106
            image_alpha = 1
107
            path_start(pt_steamworks_factory_02_throw, 5, path_action_stop, false)
108
            path_change_point(pt_steamworks_factory_02_throw, 0, obj_ceroba_npc.x, obj_ceroba_npc.y, 100)
109
            item_throw_noloop = true
110
        }
111
        if (obj_ceroba_npc.image_index >= (obj_ceroba_npc.image_number - 1))
112
        {
113
            obj_ceroba_npc.npc_direction = "right"
114
            obj_ceroba_npc.action_sprite = false
115
            stage++
116
        }
117
        break
118
    case 4:
119
        if (path_position >= 1)
120
        {
121
            if (item_wrap_correct == true)
122
            {
123
                obj_factory_02_conveyor_puzzle.conveyor_item_number -= 1
124
                audio_play_sound(snd_factory_puzzle_correct, 1, 0)
125
            }
126
            else
127
            {
128
                obj_factory_02_conveyor_puzzle.conveyor_item_number_wrong -= 1
129
                audio_play_sound(snd_fail, 1, 0)
130
            }
131
            instance_destroy()
132
        }
133
        break
134
}
135
136
vspeed += gravity
137
x += hspeed
138
y += vspeed