game

package
v0.0.0-...-c288e79 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 17, 2023 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Character

type Character struct {
	Entity
	Hitpoints    int
	Strength     int
	Speed        float64
	ActionPoints float64
	SightRange   int
	Items        []*Item
	Helmet       *Item
	Weapon       *Item
}

type Entity

type Entity struct {
	Pos
}

type Game

type Game struct {
	LevelChans []chan *Level
	InputChan  chan *Input
	Level      *Level
}

func NewGame

func NewGame(numWindows int, path string) *Game

func (*Game) Run

func (game *Game) Run()

type Input

type Input struct {
	Typ          InputType
	LevelChannel chan *Level
}

type InputType

type InputType int
const (
	None InputType = iota
	Up
	Down
	Left
	Right
	QuitGame
	CloseWindow
	Search
)

type Item

type Item struct {
	Typ ItemType
	Entity
	// contains filtered or unexported fields
}

func NewHelmet

func NewHelmet(p Pos) *Item

func NewSword

func NewSword(p Pos) *Item

type ItemType

type ItemType int
const (
	Weapon ItemType = iota
	Helmet
	Other
)

type Level

type Level struct {
	Map      [][]Tile
	Player   Player
	Monsters map[Pos]*Monster
	Debug    map[Pos]bool
}

type Monster

type Monster struct {
	Pos
	Rune         rune
	Name         string
	Hitpoints    int
	Strength     int
	Speed        float32
	ActionPoints float32
}

func NewRat

func NewRat(p Pos) *Monster

func NewSpider

func NewSpider(p Pos) *Monster

func (*Monster) Move

func (m *Monster) Move(to Pos, level *Level)

func (*Monster) Update

func (m *Monster) Update(level *Level)

type Player

type Player struct {
	Entity
}

func (*Player) Move

func (player *Player) Move(to Pos, level *Level)

type Pos

type Pos struct {
	X, Y int
}

type Tile

type Tile rune
const (
	StoneWall  Tile = '#'
	DirtFloor  Tile = '.'
	ClosedDoor Tile = '|'
	OpenDoor   Tile = '/'
	Blank      Tile = 0
	Pending    Tile = -1
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL