Randomly position new rovers
This commit is contained in:
parent
b344c4549c
commit
91947f614c
1 changed files with 8 additions and 1 deletions
|
@ -44,13 +44,20 @@ func (w *World) SpawnRover() uuid.UUID {
|
|||
|
||||
Speed: 1.0,
|
||||
Range: 20.0,
|
||||
Pos: Vector{},
|
||||
|
||||
// Set the name randomly
|
||||
Name: babble.NewBabbler().Babble(),
|
||||
},
|
||||
}
|
||||
|
||||
// Spawn in a random place near the origin
|
||||
rover.Attributes.Pos = Vector{
|
||||
10 - (rand.Int() % 20),
|
||||
10 - (rand.Int() % 20),
|
||||
}
|
||||
|
||||
// TODO: Verify no blockages in this area
|
||||
|
||||
// Append the rover to the list
|
||||
w.Rovers[rover.Id] = rover
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue