1
0
Fork 0
tetris-go/game/block.go
Henrik Hautakoski 6e21b1fcb2 feat: add game/block.go
This type represents a single block in a grid.
2025-09-14 22:16:29 +02:00

30 lines
380 B
Go

package game
import (
"tetris/assets"
"tetris/engine/graphics"
)
type Block byte
const (
BLOCK_EMPTY Block = iota
BLOCK_RED
BLOCK_GREEN
BLOCK_BLUE
BLOCK_YELLOW
BLOCK_ORANGE
BLOCK_MAGENTA
BLOCK_TEAL
)
func (c Block) Tile() graphics.Tile {
if c >= 8 {
c = BLOCK_EMPTY
}
return graphics.Tile{
Size: assets.BLOCK_TILE_SIZE,
X: byte(c),
Y: byte(0),
}
}