First pass at documentations.

This commit is contained in:
sm
2014-04-14 00:26:41 -07:00
parent 0cf0957d73
commit faacfe7fd9
12 changed files with 172 additions and 49 deletions
+5
View File
@@ -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++ {