Skip to content

Instantly share code, notes, and snippets.

@shawn42
Created May 12, 2012 16:17
Show Gist options
  • Save shawn42/2667405 to your computer and use it in GitHub Desktop.
Save shawn42/2667405 to your computer and use it in GitHub Desktop.
proposed behavior dsl
# CURRENT
has_behavior animated: {:frame_update_time => 900}
has_behavior collidable: {shape: :polygon, cw_local_points: [[4,4],[44,4],[44,44],[4,44]]}
has_behavior projectile: {speed: 0.01, direction: vec2(1,0)}
has_behavior :reversable_direction
has_behavior increasing_speed: { accel: 0.001 }
has_behavior drops: { fall_amount: 25}
has_behavior shooter: {shoots: :alien_missile, direction: vec2(0,-1)}
# PROPOSED using some sort of method missing on behavior definition or something
has_behaviors do
animated frame_update_time: 900
collidable shape: :polygon, cw_local_points: [[4,4],[44,4],[44,44],[4,44]]
projectile speed: 0.01, direction: vec2(1,0)
reversable_direction
increasing_speed accel: 0.001
drops fall_amount: 25
shooter shoots: :alien_missile, direction: vec2(0,-1)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment