objects generate entirely inside world
This commit is contained in:
parent
c8913c563e
commit
6ff9606367
@ -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{
|
||||||
|
Loading…
Reference in New Issue
Block a user