2023-12-01 21:57:52 +01:00
|
|
|
package main
|
|
|
|
|
2023-12-02 00:19:33 +01:00
|
|
|
import "fmt"
|
|
|
|
|
|
|
|
func (game *Game) initRobots() {
|
|
|
|
var fabricate int = game.level * 16
|
|
|
|
for i := 0; i < fabricate; i++ {
|
|
|
|
var found bool
|
|
|
|
var rndPos Position
|
|
|
|
for !found {
|
|
|
|
rndPos := game.randPos()
|
|
|
|
if !game.onPlayer(rndPos) {
|
|
|
|
found = true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
game.robots = append(game.robots, rndPos)
|
|
|
|
}
|
|
|
|
|
|
|
|
for _, r := range game.robots {
|
|
|
|
fmt.Println("xy", r.x, r.y)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (game *Game) drawRobots() {
|
|
|
|
for _, r := range game.robots {
|
|
|
|
game.screen.SetContent(r.x, r.y, '+', nil, game.style)
|
|
|
|
}
|
2023-12-01 21:57:52 +01:00
|
|
|
}
|
|
|
|
|
2023-12-02 00:19:33 +01:00
|
|
|
func (game *Game) drawTrash() {
|
|
|
|
for _, t := range game.trash {
|
|
|
|
game.screen.SetContent(t.x, t.y, '*', nil, game.style)
|
|
|
|
}
|
2023-12-01 21:57:52 +01:00
|
|
|
}
|