objects generate entirely inside world

This commit is contained in:
Fraser Graham 2013-11-06 19:58:16 -08:00
parent c8913c563e
commit 6ff9606367

View File

@ -12,10 +12,10 @@ type Obstacle struct {
func GenerateObstacles(count int, width, height float32) []Obstacle { func GenerateObstacles(count int, width, height float32) []Obstacle {
out := []Obstacle{} out := []Obstacle{}
for i := 0; i < count; i++ { for i := 0; i < count; i++ {
x := rand.Float32() * width x := rand.Float32() * (width - (width / 10))
y := rand.Float32() * height y := rand.Float32() * (height - (height / 10))
w := rand.Float32() * width / 10 w := rand.Float32() * (width / 10)
h := rand.Float32() * height / 10 h := rand.Float32() * (height / 10)
out = append( out = append(
out, out,
Obstacle{ Obstacle{