Bring players closer to the borders.

This commit is contained in:
Sacha Ligthert 2023-12-15 00:21:26 +01:00
parent e1ce42614c
commit 76e745801a
2 changed files with 11 additions and 11 deletions

View File

@ -65,7 +65,7 @@ func initialize() (Game, error) {
gameover: 0,
}
game.initRobots()
// game.initRobots()
return game, err
}
@ -80,12 +80,12 @@ func (game *Game) gameDirector() {
game.screen.Clear()
// Draw robots??
if len(game.robots) == 0 {
game.level++
game.cleanTrash()
game.resetPlayer()
game.initRobots()
}
// if len(game.robots) == 0 {
// game.level++
// game.cleanTrash()
// game.resetPlayer()
// game.initRobots()
// }
// Draw starter conditions
game.drawBox()
@ -171,8 +171,8 @@ func quit(game *Game) {
func (game *Game) randPos() Position {
var pos Position
x := 2 + rand.Intn(76)
y := 2 + rand.Intn(21)
x := 1 + rand.Intn(77)
y := 1 + rand.Intn(22)
pos.x = x
pos.y = y

View File

@ -12,7 +12,7 @@ func (game *Game) movePlayer(press int) {
}
if press == Left {
if game.player.position.x != 2 {
if game.player.position.x != 1 {
game.player.position.x--
game.player.moves++
}
@ -32,7 +32,7 @@ func (game *Game) movePlayer(press int) {
game.player.moves++
}
} else if press == upleft {
if game.player.position.x != 2 && game.player.position.y != 1 {
if game.player.position.x != 1 && game.player.position.y != 1 {
game.player.position.x--
game.player.position.y--
game.player.moves++