slight refactor, gofmt
This commit is contained in:
@ -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 {
|
||||
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user