Undertale script viewer

← back to main script listing

gml_Object_obj_speartile_Step_0

(view raw script w/o annotations or w/e)
1
if (con == 0)
2
{
3
    if (facer == 1 && instance_exists(obj_time))
4
    {
5
        if (obj_time.left)
6
        {
7
            x -= 60;
8
            repeat (3)
9
            {
10
                if (collision_point(x + 9, y + 35, obj_nospear, 1, 1))
11
                    x += 20;
12
            }
13
        }
14
        if (obj_time.right)
15
        {
16
            x += 60;
17
            repeat (3)
18
            {
19
                if (collision_point(x + 9, y + 35, obj_nospear, 1, 1))
20
                    x -= 20;
21
            }
22
        }
23
        if (obj_time.down)
24
        {
25
            y += 60;
26
            repeat (3)
27
            {
28
                if (collision_point(x + 9, y + 35, obj_nospear, 1, 1))
29
                    y -= 20;
30
            }
31
        }
32
        if (obj_time.up)
33
        {
34
            y -= 60;
35
            repeat (3)
36
            {
37
                if (collision_point(x + 9, y + 35, obj_nospear, 1, 1))
38
                    y += 20;
39
            }
40
        }
41
        facer = 0;
42
    }
43
    if (collision_point(x + 9, y + 35, obj_nospear, 1, 1))
44
        instance_destroy();
45
    image_alpha += 0.07;
46
    if (image_alpha > 0.9)
47
    {
48
        image_alpha = 1;
49
        con = 1;
50
        alarm[4] = 10;
51
    }
52
}
53
if (con == 2)
54
{
55
    spearbud = instance_create(x, y, obj_npc_marker);
56
    spearbud.y += 9;
57
    spearbud.y -= 9;
58
    spearbud.sprite_index = sprite_index;
59
    spearbud.image_speed = 0.5;
60
    spearbud.visible = true;
61
    with (spearbud)
62
        scr_depth
scr_depth

depth = 50000 - ((y * 10) + (sprite_height * 10));
();
63
    con = 2.5;
64
}
65
if (con == 2.5)
66
{
67
    if (spearbud.image_index >= 1.5 && active == 1)
68
    {
69
        if (collision_rectangle(bbox_left, bbox_top, bbox_right, bbox_bottom, obj_mainchara, 0, 1))
70
            event_user(3);
71
        if (sounded == 0 && instance_exists(obj_speartilegen))
72
        {
73
            obj_speartilegen.sound2 = snd_sparkle1;
74
            sounded = 1;
75
        }
76
    }
77
    if (spearbud.image_index >= 3)
78
    {
79
        spearbud.image_speed = 0;
80
        con = 3;
81
        alarm[4] = 5;
82
    }
83
}
84
if (con == 4)
85
{
86
    image_alpha -= 0.1;
87
    spearbud.image_alpha = image_alpha;
88
    if (image_alpha < 0.1)
89
    {
90
        with (spearbud)
91
            instance_destroy();
92
        instance_destroy();
93
    }
94
}
95
if (duty == 1)
96
{
97
    x = obj_mainchara.x;
98
    y = obj_mainchara.y;
99
    duty = 0;
100
    move_snap(20, 20);
101
}
102
if (active == 2)
103
{
104
    if (con >= 2.5)
105
    {
106
        if (instance_exists(spearbud))
107
        {
108
            with (spearbud)
109
                instance_destroy();
110
        }
111
    }
112
    instance_destroy();
113
}