Resets player position at the start of a new level. Closes #12

This commit is contained in:
Sacha Ligthert 2023-12-11 01:04:38 +01:00
parent 5e587bc348
commit 1542837738
2 changed files with 13 additions and 6 deletions

14
game.go
View File

@ -86,17 +86,19 @@ func (game *Game) gameDirector() {
// Clean the screen // Clean the screen
game.screen.Clear() game.screen.Clear()
// Draw robots??
if len(game.robots) == 0 {
game.level++
game.cleanTrash()
game.resetPlayer()
game.initRobots()
}
// Draw starter conditions // Draw starter conditions
game.drawBox() game.drawBox()
game.drawPlayer() game.drawPlayer()
//game.drawCoords() //game.drawCoords()
// Draw robots??
if len(game.robots) == 0 {
game.level++
game.cleanTrash()
game.initRobots()
}
game.drawRobots() game.drawRobots()
// Draw my ex-wife // Draw my ex-wife

View File

@ -119,3 +119,8 @@ func (game *Game) onPlayer(pos Position) bool {
} }
return onPlayer return onPlayer
} }
func (game *Game) resetPlayer() {
game.player.position.x = 40
game.player.position.y = 12
}