From 76e745801a5c16e2e66258526c0acd37e44ee4c4 Mon Sep 17 00:00:00 2001 From: Sacha Ligthert Date: Fri, 15 Dec 2023 00:21:26 +0100 Subject: [PATCH] Bring players closer to the borders. --- robots/game.go | 18 +++++++++--------- robots/player.go | 4 ++-- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/robots/game.go b/robots/game.go index 025ff4f..3959201 100644 --- a/robots/game.go +++ b/robots/game.go @@ -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 diff --git a/robots/player.go b/robots/player.go index d61ecd6..d7c03f6 100644 --- a/robots/player.go +++ b/robots/player.go @@ -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++