First pass at documentations.
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
||||
v "bitbucket.org/hackerbots/vector"
|
||||
)
|
||||
|
||||
// Obstacle is the implementation of the generic building type in the game.
|
||||
type Obstacle struct {
|
||||
Bounds v.AABB2d `json:"bounds"`
|
||||
Hp int `json:"-"`
|
||||
@@ -28,6 +29,8 @@ func (o Obstacle) minify() [4]int {
|
||||
return out
|
||||
}
|
||||
|
||||
// MinifyObstacles is a function used to convert []osbstacles into more tightly
|
||||
// packed [][4]int for smaller json payloads
|
||||
func MinifyObstacles(o []Obstacle) [][4]int {
|
||||
out := [][4]int{}
|
||||
for i := range o {
|
||||
@@ -36,6 +39,8 @@ func MinifyObstacles(o []Obstacle) [][4]int {
|
||||
return out
|
||||
}
|
||||
|
||||
// GenerateObstacles returns a slice of (count) obstacles within a region
|
||||
// bounded by width, height.
|
||||
func GenerateObstacles(count int, width, height float32) []Obstacle {
|
||||
out := []Obstacle{}
|
||||
for i := 0; i < count; i++ {
|
||||
|
||||
Reference in New Issue
Block a user