Randomly position new rovers

This commit is contained in:
Marc Di Luzio 2020-06-06 18:45:15 +01:00
parent b344c4549c
commit 91947f614c

View file

@ -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