cartography

package
v0.0.0-...-7004f9a Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Direction

type Direction string
const (
	DirectionUp        Direction = "up"
	DirectionDown      Direction = "down"
	DirectionLeft      Direction = "left"
	DirectionRight     Direction = "right"
	DirectionDownRight Direction = "downright"
	DirectionDownLeft  Direction = "downleft"
	DirectionUpLeft    Direction = "upleft"
	DirectionUpRight   Direction = "upright"
	NoDirection        Direction = "none"
)

type LevelManager

type LevelManager struct {
	// contains filtered or unexported fields
}

A LevelManager manages the multiple levels in a game world, and simplifies the transitions between them.

func NewLevelManager

func NewLevelManager(levelFilePath string, seed int64) *LevelManager

NewLevelManager initializes & returns a new level manager.

func (*LevelManager) AddLevel

func (m *LevelManager) AddLevel(name string, template LevelTemplate) Map

AddLevel adds a new level to the manager.

func (*LevelManager) GetLevel

func (m *LevelManager) GetLevel(name string) (Map, bool)

GetLevel returns the desired level given its name.

type LevelTemplate

type LevelTemplate interface {
	Generate(source *rand.Rand) Map
}

A LevelTemplate implements logic for generating a single level (or "floor").

type Map

type Map [][]Tile

func NewMap

func NewMap(x, y int) Map

func (Map) At

func (m Map) At(position structure.Vec) *Tile

func (Map) Set

func (m Map) Set(tile Tile)

func (Map) SizeX

func (m Map) SizeX() int

func (Map) SizeY

func (m Map) SizeY() int

type Tile

type Tile struct {
	Position structure.Vec

	Type string // TODO: Find better way of representing tile type.

	Visibility float64 // 0.0 is invisible, 1.0 is fully lit.

	Char    rune
	FgColor color.Color
	BgColor color.Color
}

Jump to

Keyboard shortcuts

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