Skip to content

Instantly share code, notes, and snippets.

@Hexagon
Created February 28, 2017 20:21
Show Gist options
  • Save Hexagon/3f6744c7f4b3edac200cc262cce84f9e to your computer and use it in GitHub Desktop.
Save Hexagon/3f6744c7f4b3edac200cc262cce84f9e to your computer and use it in GitHub Desktop.
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