Undertale script viewer

← back to main script listing

gml_Object_obj_alabdoor_l_Draw_0

(view raw script w/o annotations or w/e)
1
if (side == 0)
2
{
3
    if (active == 1)
4
    {
5
        if (instance_exists(obj_mainchara))
6
        {
7
            if (distance_to_object(obj_mainchara) < 40)
8
            {
9
                if (open == 0)
10
                    caster_play(snd_elecdoor_open, 1, 1);
11
                open = 1;
12
            }
13
            if (distance_to_object(obj_mainchara) > 50)
14
            {
15
                if (open == 1)
16
                    caster_play(snd_elecdoor_close, 1, 1);
17
                open = 0;
18
            }
19
        }
20
    }
21
    if (open == -1)
22
        open = 0;
23
    if (doorx < 7)
24
        draw_sprite_part(spr_alabdoor_piece, 0, 0, 0, 8 - doorx, 61, x, y + 4);
25
    if (doorx < 7)
26
        draw_sprite_part(spr_alabdoor_piece, 0, doorx, 0, 8 - doorx, 61, x + 6 + doorx, y + 10);
27
    if (open == 1)
28
    {
29
        if (doorx < 8)
30
            doorx += 1;
31
    }
32
    if (open == 0)
33
    {
34
        if (doorx > 0)
35
            doorx -= 1;
36
    }
37
    draw_sprite(spr_labdoor_hang, 0, x, y);
38
}
39
if (side == 1)
40
{
41
    if (active == 1)
42
    {
43
        if (instance_exists(obj_mainchara))
44
        {
45
            if (distance_to_object(obj_mainchara) < 30)
46
            {
47
                if (open == 0)
48
                    caster_play(snd_elecdoor_open, 1, 1);
49
                open = 1;
50
            }
51
            if (distance_to_object(obj_mainchara) > 50)
52
            {
53
                if (open == 1)
54
                    caster_play(snd_elecdoor_close, 1, 1);
55
                open = 0;
56
            }
57
        }
58
    }
59
    if (open == -1)
60
        open = 0;
61
    if (doorx < 7)
62
        draw_sprite_part(spr_alabdoor_piece_r, 0, 0, 0, 8 - doorx, 61, x + 19, y + 10);
63
    if (doorx < 7)
64
        draw_sprite_part(spr_alabdoor_piece_r, 0, doorx, 0, 8 - doorx, 61, x + 25 + doorx, y + 4);
65
    if (open == 1)
66
    {
67
        if (doorx < 8)
68
            doorx += 1;
69
    }
70
    if (open == 0)
71
    {
72
        if (doorx > 0)
73
            doorx -= 1;
74
    }
75
    draw_sprite(spr_labdoor_hang_r, 0, x, y);
76
}