Created
February 28, 2017 20:21
-
-
Save Hexagon/3f6744c7f4b3edac200cc262cce84f9e to your computer and use it in GitHub Desktop.
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
func TetrominoFactory() Tetromino { | |
var tt rune = implementedTetrominos[rand.Intn(len(implementedTetrominos))] | |
switch tt { | |
case 'I': | |
return Tetromino{tt, []Sprite{ | |
Sprite{[]Vector{{0, 1}, {1, 1}, {2, 1}, {3, 1}}}, | |
Sprite{[]Vector{{2, 0}, {2, 1}, {2, 2}, {2, 3}}}, | |
Sprite{[]Vector{{0, 2}, {1, 2}, {2, 2}, {3, 2}}}, | |
Sprite{[]Vector{{1, 0}, {1, 1}, {1, 2}, {1, 3}}}, | |
}} | |
case 'J': | |
return Tetromino{tt, []Sprite{ | |
Sprite{[]Vector{{0, 0}, {0, 1}, {1, 1}, {2, 1}}}, | |
Sprite{[]Vector{{1, 0}, {2, 0}, {1, 1}, {1, 2}}}, | |
Sprite{[]Vector{{0, 1}, {1, 1}, {2, 1}, {2, 2}}}, | |
Sprite{[]Vector{{1, 0}, {1, 1}, {1, 2}, {0, 2}}}, | |
}} | |
// ... | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment