Created
August 27, 2012 02:11
-
-
Save kurrik/3485036 to your computer and use it in GitHub Desktop.
My favorite code from this weekend
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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