|
|
@@ -1,9 +1,5 @@
|
|
|
package main
|
|
|
|
|
|
-import (
|
|
|
- "math/rand"
|
|
|
-)
|
|
|
-
|
|
|
func (game *Game) drawPlayer() {
|
|
|
game.screen.SetContent(game.player.position.x, game.player.position.y, '@', nil, game.style)
|
|
|
}
|
|
|
@@ -60,25 +56,9 @@ func (g *Game) movePlayer(game *Game, press int) {
|
|
|
}
|
|
|
|
|
|
func (game *Game) teleport() {
|
|
|
- // Draw something nice
|
|
|
- // Use 1+rand.Intn(77) instead this
|
|
|
-
|
|
|
- var safe bool = false
|
|
|
- var x, y int
|
|
|
-
|
|
|
- for !safe {
|
|
|
- x = rand.Intn(80)
|
|
|
- y = rand.Intn(24)
|
|
|
-
|
|
|
- if x == 0 || x == 79 || y == 0 || y == 23 {
|
|
|
- safe = false
|
|
|
- } else {
|
|
|
- safe = true
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- game.player.position.x = x
|
|
|
- game.player.position.y = y
|
|
|
+ pos := game.randPos()
|
|
|
+ game.player.position.x = pos.x
|
|
|
+ game.player.position.y = pos.y
|
|
|
}
|
|
|
|
|
|
func (game *Game) onPlayer(pos Position) bool {
|