66 lines
1.7 KiB
Go
66 lines
1.7 KiB
Go
|
package main
|
||
|
|
||
|
import . "git.danitheskunk.com/squishy/blooblib"
|
||
|
|
||
|
type Game struct {
|
||
|
tilemap *Tilemap
|
||
|
}
|
||
|
|
||
|
func (g *Game) Init(settings *Settings) {
|
||
|
settings.Title = "Goo v0.0"
|
||
|
|
||
|
tiles := LoadImage("go.png").MakeTileset(Vec2i{X: 16, Y: 16})
|
||
|
g.tilemap = NewTilemap(Vec2i{X: 40, Y: 23}, tiles)
|
||
|
g.tilemap.Clear(16)
|
||
|
for y := 0; y < 19; y += 1 {
|
||
|
for x := 0; x < 19; x += 1 {
|
||
|
g.tilemap.Set(Vec2i{X: 10 + x, Y: 1 + y}, 3)
|
||
|
}
|
||
|
g.tilemap.Set(Vec2i{X: 10, Y: 1 + y}, 11)
|
||
|
g.tilemap.Set(Vec2i{X: 28, Y: 1 + y}, 12)
|
||
|
}
|
||
|
|
||
|
for x := 0; x < 19; x += 1 {
|
||
|
g.tilemap.Set(Vec2i{X: 10 + x, Y: 1}, 9)
|
||
|
g.tilemap.Set(Vec2i{X: 10 + x, Y: 19}, 10)
|
||
|
g.tilemap.Set(Vec2i{X: 10 + x, Y: 20}, 17)
|
||
|
g.tilemap.Set(Vec2i{X: 10 + x, Y: 21}, 18)
|
||
|
}
|
||
|
|
||
|
for y := 0; y < 21; y += 1 {
|
||
|
g.tilemap.Set(Vec2i{X: 29, Y: 1 + y}, 19)
|
||
|
}
|
||
|
g.tilemap.Set(Vec2i{X: 10, Y: 21}, 20)
|
||
|
g.tilemap.Set(Vec2i{X: 29, Y: 1}, 21)
|
||
|
|
||
|
g.tilemap.Set(Vec2i{X: 10, Y: 1}, 5)
|
||
|
g.tilemap.Set(Vec2i{X: 28, Y: 1}, 6)
|
||
|
g.tilemap.Set(Vec2i{X: 10, Y: 19}, 7)
|
||
|
g.tilemap.Set(Vec2i{X: 28, Y: 19}, 8)
|
||
|
|
||
|
g.tilemap.Set(Vec2i{X: 13, Y: 4}, 4)
|
||
|
g.tilemap.Set(Vec2i{X: 25, Y: 4}, 4)
|
||
|
g.tilemap.Set(Vec2i{X: 13, Y: 16}, 4)
|
||
|
g.tilemap.Set(Vec2i{X: 25, Y: 16}, 4)
|
||
|
g.tilemap.Set(Vec2i{X: 13, Y: 10}, 4)
|
||
|
g.tilemap.Set(Vec2i{X: 13, Y: 16}, 4)
|
||
|
g.tilemap.Set(Vec2i{X: 25, Y: 10}, 4)
|
||
|
g.tilemap.Set(Vec2i{X: 25, Y: 16}, 4)
|
||
|
g.tilemap.Set(Vec2i{X: 19, Y: 4}, 4)
|
||
|
g.tilemap.Set(Vec2i{X: 19, Y: 10}, 4)
|
||
|
g.tilemap.Set(Vec2i{X: 19, Y: 16}, 4)
|
||
|
}
|
||
|
|
||
|
func (g *Game) Render(screen *Image) {
|
||
|
screen.DrawTilemap(g.tilemap, Vec2i{})
|
||
|
screen.Draw(g.tilemap.Tileset[2], Vec2i{X: 16 * 25, Y: 16 * 4})
|
||
|
screen.Draw(g.tilemap.Tileset[1], Vec2i{X: 16 * 13, Y: 16 * 16})
|
||
|
}
|
||
|
|
||
|
func (g *Game) Update() {
|
||
|
}
|
||
|
|
||
|
func main() {
|
||
|
Run(&Game{})
|
||
|
}
|