slight refactor, gofmt

This commit is contained in:
2019-10-26 23:32:32 +03:00
parent 32c598f9e0
commit ec9d3d9a73
20 changed files with 303 additions and 239 deletions

View File

@ -1,14 +1,60 @@
package gamemap
import "lab.zaar.be/thefish/alchemyst-go/engine/ecs"
import (
"lab.zaar.be/thefish/alchemyst-go/engine/ecs"
"lab.zaar.be/thefish/alchemyst-go/util"
)
var maxrooms = 100
var mapWidth = 150
var mapHeight = 100
type Level struct {
Name string
Branch string
Depth int
Name string
Branch string
Depth int
MaxRooms int
Width int
Height int
Objects []ecs.Entity
Tiles [][]*Tile
}
Width int
Height int
Objects []ecs.Entity
Tiles [][]*Tile
}
func NewLevel(ctx util.ClientCtx, branch string, depth int) *Level {
l := &Level{
Name: branch + string(depth),
Depth: depth,
MaxRooms: maxrooms,
Width: mapWidth,
Height: mapHeight,
}
l.Tiles = make([][]*Tile, l.Width)
for i := range l.Tiles {
l.Tiles[i] = make([]*Tile, l.Height)
}
return l
}
func Generate(l *Level) (l *Level) {
for i := 0; i < l.MaxRooms; i++ {
}
return l
}
type Room struct {
x, y, w, h int
}
func (self *Room) intersects(other *Room) bool {
if self.x <= (other.x+other.w) &&
(self.x+self.w) >= other.x &&
self.y <= (other.y+other.h) &&
(self.y+self.h) >= other.y {
}
}