Skip to content

Instantly share code, notes, and snippets.

@kurrik
Created August 27, 2012 02:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kurrik/3485036 to your computer and use it in GitHub Desktop.
Save kurrik/3485036 to your computer and use it in GitHub Desktop.
My favorite code from this weekend
// I couldn't have come up with this sober / well rested
const (
FACING_LEFT = 1 << iota
FACING_RIGHT = 1 << iota
PLAYER_STOPPED = 1 << iota
PLAYER_WALKING = 1 << iota
PLAYER_JUMPING = 1 << iota
)
a := map[int]*Animation{
PLAYER_STOPPED | FACING_LEFT: Anim([]int{4, 5}, 400),
PLAYER_STOPPED | FACING_RIGHT: Anim([]int{0, 1}, 400),
PLAYER_WALKING | FACING_LEFT: Anim([]int{3, 5}, 80),
PLAYER_WALKING | FACING_RIGHT: Anim([]int{0, 2}, 80),
PLAYER_JUMPING | FACING_LEFT: Anim([]int{5}, 80),
PLAYER_JUMPING | FACING_RIGHT: Anim([]int{0}, 80),
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment