Bring players closer to the borders.
This commit is contained in:
parent
e1ce42614c
commit
76e745801a
@ -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
|
||||
|
@ -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++
|
||||
|
Loading…
x
Reference in New Issue
Block a user