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.
40 lines
479 B
40 lines
479 B
3 days ago
|
package main
|
||
|
|
||
|
import (
|
||
|
"github.com/gdamore/tcell/v2"
|
||
|
)
|
||
|
|
||
|
const (
|
||
|
WALL = '#'
|
||
|
SPACE = '.'
|
||
|
PATH_LIMIT = 1000
|
||
|
RENDER = true
|
||
|
SHOW_RENDER = false
|
||
|
SHOW_PATHS = false
|
||
|
HEARING_DISTANCE = 6
|
||
|
)
|
||
|
|
||
|
type Map [][]rune
|
||
|
type Paths [][]int
|
||
|
|
||
|
type Position struct {
|
||
|
X int
|
||
|
Y int
|
||
|
}
|
||
|
|
||
|
type Enemy struct {
|
||
|
HP int
|
||
|
Pos Position
|
||
|
Damage int
|
||
|
}
|
||
|
|
||
|
type Game struct {
|
||
|
Screen tcell.Screen
|
||
|
Level Map
|
||
|
Player Enemy
|
||
|
Status string
|
||
|
Width int
|
||
|
Height int
|
||
|
Enemies map[Position]*Enemy
|
||
|
}
|