Skip to content

Instantly share code, notes, and snippets.

@jonathanmuth
Last active August 29, 2015 14:04
Show Gist options
  • Save jonathanmuth/142725443bb3c32cddb6 to your computer and use it in GitHub Desktop.
Save jonathanmuth/142725443bb3c32cddb6 to your computer and use it in GitHub Desktop.
Automatic Door
{
id: "door",
is_human: false,
editor_info: { category: "props_interactive" },
solid_dimensions: ["player", "interactive"],
on_collide_head: "if(collide_with_area = 'body', fire_event('open_door'))",
on_collide_feet: "if(collide_with_area = 'body', fire_event('open_door'))",
on_open_door: "if(not (animation in ['open', 'opened']), set(animation, 'open'))",
on_end_open_anim: "set(animation, 'opened')",
on_end_opened_anim: "set(animation, 'close')",
on_end_close_anim: "set(animation, 'closed')",
animation: [
{
id: "normal",
image: "props/door.png",
body_area: "all",
rect: [11,7,76,66],
velocity_x: 0,
velocity_y: 0,
},
{
id: "closed",
image: "props/door.png",
body_area: "all",
rect: [11,7,76,66],
velocity_x: 0,
velocity_y: 0,
},
{
id: "open",
image: "props/door.png",
body_area: "all",
rect: [11,7,76,66],
velocity_x: 0,
velocity_y: 0,
frames: 8,
pad: 14,
duration: 20,
},
{
id: "close",
image: "props/door.png",
body_area: "all",
rect: [11,7,76,66],
velocity_x: 0,
velocity_y: 0,
frames: 8,
pad: 14,
duration: 8,
play_backwards: true,
},
{
id: "opened",
image: "props/door.png",
body_area: "all",
rect: [571,7,636,66],
velocity_x: 0,
velocity_y: 0,
duration: 20,
},
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment