game

package
v0.0.0-...-11e9a73 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Game

type Game struct {
	Players                           map[int]interfaces.Player
	Spectators                        map[int]interfaces.Spectator
	Boards                            map[int]interfaces.Board
	Entities                          map[int]interfaces.Entity
	PlayersToEntities                 map[interfaces.Player]interfaces.Entity
	LastTick, CurrentBoard, NumBoards int
	GameRunning                       bool
}

func NewGame

func NewGame() *Game

func (*Game) AddBoard

func (g *Game) AddBoard(board interfaces.Board)

func (*Game) AddEntity

func (g *Game) AddEntity(entity interfaces.Entity)

func (*Game) AddPlayer

func (g *Game) AddPlayer(player interfaces.Player, entity interfaces.Entity)

func (*Game) AddSpectator

func (g *Game) AddSpectator(spec interfaces.Spectator)

func (*Game) CanMoveToSpace

func (g *Game) CanMoveToSpace(targetBoardId, locX, locY int) bool

Checks if an entity may be placed into a given tile on the current board

func (*Game) GetBoard

func (g *Game) GetBoard(boardId int) interfaces.Board

func (*Game) GetBoards

func (g *Game) GetBoards() map[int]interfaces.Board

func (*Game) GetCurrentBoard

func (g *Game) GetCurrentBoard() int

func (*Game) GetEntities

func (g *Game) GetEntities() map[int]interfaces.Entity

func (*Game) GetEntitiesAtSpace

func (g *Game) GetEntitiesAtSpace(boardId, x, y int) []interfaces.Entity

func (*Game) GetEntity

func (g *Game) GetEntity(entid int) interfaces.Entity

func (*Game) GetEntityByPlayer

func (g *Game) GetEntityByPlayer(player interfaces.Player) interfaces.Entity

func (*Game) GetLastTick

func (g *Game) GetLastTick() int

func (*Game) GetNumBoards

func (g *Game) GetNumBoards() int

func (*Game) GetPlayer

func (g *Game) GetPlayer(id int) interfaces.Player

func (*Game) GetPlayerByEntity

func (g *Game) GetPlayerByEntity(entity interfaces.Entity) interfaces.Player

func (*Game) GetPlayers

func (g *Game) GetPlayers() map[int]interfaces.Player

func (*Game) GetRandomEmptySpace

func (g *Game) GetRandomEmptySpace() (int, int)

Picks a random empty space

func (*Game) GetSpectators

func (g *Game) GetSpectators() map[int]interfaces.Spectator

func (*Game) GetTangibleEntityAtSpace

func (g *Game) GetTangibleEntityAtSpace(bId, x, y int) interfaces.Entity

func (*Game) IsFire

func (g *Game) IsFire(boardId, x, y int) bool

Checks if there's fire at a given tile

func (*Game) IsWall

func (g *Game) IsWall(boardId, x, y int) bool

Checks if there's a wall at a given tile

func (*Game) IsWater

func (g *Game) IsWater(boardId, x, y int) bool

Checks if there's water at a given tile

func (*Game) Json

func (g *Game) Json(player interfaces.Player) string

Generates the gamestate for the given player's perspective

func (*Game) NextBoard

func (g *Game) NextBoard()

func (*Game) PlaceAtNearestTile

func (g *Game) PlaceAtNearestTile(ent interfaces.Entity, boardId, x, y int)

func (*Game) Run

func (g *Game) Run()

func (*Game) SetLastTick

func (g *Game) SetLastTick(tick int)

Jump to

Keyboard shortcuts

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