A Go version of the https://lcthw.dev/learn-code-the-hard-way/curseyou-python-rogue that makes a tiny Rogue in Go.
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
13 lines
229 B
13 lines
229 B
3 days ago
|
package main
|
||
|
|
||
|
func (game *Game) MovePlayer(x_delta int, y_delta int) {
|
||
|
target := Position{
|
||
|
game.Player.Pos.X + x_delta,
|
||
|
game.Player.Pos.Y + y_delta,
|
||
|
}
|
||
|
|
||
|
if !game.Occupied(target) {
|
||
|
game.Player.Pos = target
|
||
|
}
|
||
|
}
|