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,
|
gameover: 0,
|
||||||
}
|
}
|
||||||
|
|
||||||
game.initRobots()
|
// game.initRobots()
|
||||||
|
|
||||||
return game, err
|
return game, err
|
||||||
}
|
}
|
||||||
@ -80,12 +80,12 @@ func (game *Game) gameDirector() {
|
|||||||
game.screen.Clear()
|
game.screen.Clear()
|
||||||
|
|
||||||
// Draw robots??
|
// Draw robots??
|
||||||
if len(game.robots) == 0 {
|
// if len(game.robots) == 0 {
|
||||||
game.level++
|
// game.level++
|
||||||
game.cleanTrash()
|
// game.cleanTrash()
|
||||||
game.resetPlayer()
|
// game.resetPlayer()
|
||||||
game.initRobots()
|
// game.initRobots()
|
||||||
}
|
// }
|
||||||
|
|
||||||
// Draw starter conditions
|
// Draw starter conditions
|
||||||
game.drawBox()
|
game.drawBox()
|
||||||
@ -171,8 +171,8 @@ func quit(game *Game) {
|
|||||||
func (game *Game) randPos() Position {
|
func (game *Game) randPos() Position {
|
||||||
var pos Position
|
var pos Position
|
||||||
|
|
||||||
x := 2 + rand.Intn(76)
|
x := 1 + rand.Intn(77)
|
||||||
y := 2 + rand.Intn(21)
|
y := 1 + rand.Intn(22)
|
||||||
|
|
||||||
pos.x = x
|
pos.x = x
|
||||||
pos.y = y
|
pos.y = y
|
||||||
|
@ -12,7 +12,7 @@ func (game *Game) movePlayer(press int) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if press == Left {
|
if press == Left {
|
||||||
if game.player.position.x != 2 {
|
if game.player.position.x != 1 {
|
||||||
game.player.position.x--
|
game.player.position.x--
|
||||||
game.player.moves++
|
game.player.moves++
|
||||||
}
|
}
|
||||||
@ -32,7 +32,7 @@ func (game *Game) movePlayer(press int) {
|
|||||||
game.player.moves++
|
game.player.moves++
|
||||||
}
|
}
|
||||||
} else if press == upleft {
|
} 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.x--
|
||||||
game.player.position.y--
|
game.player.position.y--
|
||||||
game.player.moves++
|
game.player.moves++
|
||||||
|
Loading…
x
Reference in New Issue
Block a user