package main import "image/color" type TileType int const ( TileEmpty TileType = iota TileGround TileBrick TileQuestion ) type Tile struct { Type TileType Color color.RGBA } type Level struct { Width int Height int Tiles [][]TileType } func NewLevel11() *Level { width := 100 height := 15 tiles := make([][]TileType, height) for i := range tiles { tiles[i] = make([]TileType, width) } // Floor for x := 0; x < width; x++ { tiles[14][x] = TileGround tiles[13][x] = TileGround } // Basic 1-1 elements tiles[12][10] = TileQuestion tiles[12][11] = TileBrick tiles[12][12] = TileQuestion tiles[12][13] = TileBrick tiles[12][14] = TileQuestion // Some bricks/blocks for x := 20; x < 25; x++ { tiles[10][x] = TileBrick } return &Level{ Width: width, Height: height, Tiles: tiles, } } func (l *Level) GetTile(x, y int) TileType { if x < 0 || x >= l.Width || y < 0 || y >= l.Height { return TileEmpty } return l.Tiles[y][x] }