| 1 |
s_buffer += 1; |
| 2 |
draw_set_color(c_black); |
| 3 |
ossafe_fill_rectangle(x, y, x + 40, y + 60); |
| 4 |
if (open == 1) |
| 5 |
{ |
| 6 |
if (instance_exists(s1)) |
| 7 |
{ |
| 8 |
with (s1) |
| 9 |
instance_destroy(); |
| 10 |
with (s2) |
| 11 |
instance_destroy(); |
| 12 |
} |
| 13 |
if (ox < 20) |
| 14 |
{ |
| 15 |
ox += 2; |
| 16 |
c_sound = 0; |
| 17 |
s_sound = 0; |
| 18 |
} |
| 19 |
if (ox >= 20) |
| 20 |
ox = 30; |
| 21 |
} |
| 22 |
if (open == 0) |
| 23 |
{ |
| 24 |
if (instance_exists(s1) == 0) |
| 25 |
{ |
| 26 |
s1 = instance_create(x, y + 40, obj_solidsmall); |
| 27 |
s2 = instance_create(x + 20, y + 40, obj_solidsmall); |
| 28 |
} |
| 29 |
if (ox > 0) |
| 30 |
{ |
| 31 |
ox -= 2; |
| 32 |
o_sound = 0; |
| 33 |
} |
| 34 |
if (ox < 0) |
| 35 |
{ |
| 36 |
ox = 0; |
| 37 |
if (s_sound == 0) |
| 38 |
{ |
| 39 |
snd_play(snd_elecdoor_shutheavy); |
| 40 |
s_sound = 1; |
| 41 |
} |
| 42 |
} |
| 43 |
} |
| 44 |
anim += 1; |
| 45 |
if (ox < 20) |
| 46 |
{ |
| 47 |
draw_sprite_part(spr_darkelevator_l, 0, ox, 0, 20 - ox, 60, x, y); |
| 48 |
draw_sprite_part(spr_darkelevator_r, 0, 0, 0, 20 - ox, 60, x + 20 + ox, y); |
| 49 |
if (type == 1) |
| 50 |
{ |
| 51 |
draw_sprite_part(spr_megadoor_l, 0, ox, 0, 20 - ox, 60, x, y); |
| 52 |
if (red == 1) |
| 53 |
draw_sprite_part(spr_megadoor_red, floor(anim / 5), ox, 0, 19 - ox, 12, x, y + 12); |
| 54 |
if (yel == 1) |
| 55 |
draw_sprite_part(spr_megadoor_yellow, floor(anim / 5), ox, 0, 19 - ox, 12, x, y + 25); |
| 56 |
draw_sprite_part(spr_megadoor_r, 0, 0, 0, 20 - ox, 60, x + 20 + ox, y); |
| 57 |
if (blu == 1) |
| 58 |
draw_sprite_part(spr_megadoor_blue, floor(anim / 5), 0, 0, 17 - ox, 10, x + 23 + ox, y + 13); |
| 59 |
if (gre == 1) |
| 60 |
draw_sprite_part(spr_megadoor_green, floor(anim / 5), 0, 0, 17 - ox, 10, x + 23 + ox, y + 26); |
| 61 |
} |
| 62 |
if (type == 2) |
| 63 |
{ |
| 64 |
draw_sprite_part(spr_door_redkey, 0, ox, 0, 20 - ox, 37, x, y); |
| 65 |
draw_sprite_part(spr_door_redkey_r, 0, 0, 0, 20 - ox, 37, x + 20 + ox, y); |
| 66 |
if (red == 1) |
| 67 |
{ |
| 68 |
w = 13 - ox; |
| 69 |
if (w < 0) |
| 70 |
w = 0; |
| 71 |
draw_sprite_part(spr_door_redkey_brightl, floor(anim / 5), ox, 0, w, 15, x + 7, y + 18); |
| 72 |
w = 15 - ox; |
| 73 |
if (w < 0) |
| 74 |
w = 0; |
| 75 |
draw_sprite_part(spr_door_redkey_brightr, floor(anim / 5), 0, 0, w, 15, x + 20 + ox, y + 18); |
| 76 |
} |
| 77 |
} |
| 78 |
} |
| 79 |
draw_sprite(spr_door_edge, 0, x - 4, y - 3); |
| 80 |
if (instance_exists(obj_mainchara)) |
| 81 |
{ |
| 82 |
if (point_distance(x + 20, y + 60, obj_mainchara.x + 10, obj_mainchara.bbox_top) > 50) |
| 83 |
{ |
| 84 |
if (open == 1) |
| 85 |
caster_play(snd_elecdoor_close, 1, 1); |
| 86 |
open = 0; |
| 87 |
} |
| 88 |
if (point_distance(x + 20, y + 60, obj_mainchara.x + 10, obj_mainchara.bbox_top) < 40 && shouldopen == 1) |
| 89 |
{ |
| 90 |
if (open == 0) |
| 91 |
caster_play(snd_elecdoor_open, 1, 1); |
| 92 |
open = 1; |
| 93 |
} |
| 94 |
} |