1 |
draw_sprite(spr_slidingdoor, 0, x + slidedoorx, y); |
2 |
draw_sprite(sprite_index, 0, x, y); |
3 |
if (active == 1) |
4 |
{ |
5 |
if (instance_exists(obj_mainchara)) |
6 |
{ |
7 |
if ((distance_to_object(obj_mainchara) < 40 && on == -1) || on == 0) |
8 |
on = 1; |
9 |
if ((distance_to_object(obj_mainchara) > 60 && on == 1) || on == 0) |
10 |
on = -1; |
11 |
} |
12 |
} |
13 |
if (on == 1) |
14 |
{ |
15 |
c_noise = 0; |
16 |
s_noise = 0; |
17 |
if (o_noise == 0) |
18 |
{ |
19 |
snd_play(snd_elecdoor_open); |
20 |
o_noise = 1; |
21 |
} |
22 |
if (slidedoorx < 40) |
23 |
{ |
24 |
slidedoorx += 5; |
25 |
} |
26 |
else |
27 |
{ |
28 |
on = 0; |
29 |
if (active == 0) |
30 |
snd_play(snd_elecdoor_shut); |
31 |
} |
32 |
} |
33 |
if (on == -1) |
34 |
{ |
35 |
o_noise = 0; |
36 |
s_noise = 0; |
37 |
if (c_noise == 0) |
38 |
{ |
39 |
snd_play(snd_elecdoor_close); |
40 |
c_noise = 1; |
41 |
} |
42 |
if (slidedoorx > 0) |
43 |
{ |
44 |
slidedoorx -= 5; |
45 |
} |
46 |
else |
47 |
{ |
48 |
slidedoorx = 0; |
49 |
on = 0; |
50 |
if (active == 0) |
51 |
snd_play(snd_elecdoor_shut); |
52 |
} |
53 |
} |