Documentation ¶
Index ¶
Constants ¶
const ( // SquadToken represents the Token for a Squad. SquadToken TokenType = 1 // GateToken represents the Token for an exit gate. GateToken = 2 // MerchantToken represents a stop where the player can buy stuff. MerchantToken = 4 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CollisionSystem ¶
type CollisionSystem struct {
// contains filtered or unexported fields
}
CollisionSystem generates collision events when two Tokens occupy the same node.
func NewCollisionSystem ¶
func NewCollisionSystem(mgr *ecs.World, bus *event.Bus) *CollisionSystem
NewCollisionSystem creates a new Collision System.
type CombatInitiated ¶
CombatInitiated occurs when the player has met another squad for combat.
type Complete ¶
type Complete struct{}
Complete happens when the player escapes the current overworld through the gate.
type InterestRoll ¶
InterestRoll contains a slice of Options to pick from, and a number of times to pick.
type KeyPair ¶
KeyPair is a pair of geom.Keys that represents a linkage between two overworld nodes.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager is a game state that allows the player to pick which path to take, and which combat to enter etc.
func NewManager ¶
NewManager creates a new overworld Manager.
func (*Manager) Disable ¶
func (m *Manager) Disable()
Disable the overworld Manager, ignoring input and not rendering the state of the overworld.
func (*Manager) Enable ¶
func (m *Manager) Enable()
Enable the overworld Manager, responding to input and rendering the state of the overworld.
func (*Manager) End ¶
func (m *Manager) End()
End should be called when the current overworld map is complete, and the player is selecting another map to go to.
func (*Manager) MousePosition ¶
MousePosition handles a change in the mouse position from the player.
type Map ¶
type Map struct { // Terrain stores the visible tiles of an overworld. Terrain map[geom.Key]TileID // Nodes stores the stops on the overworld, and the traversable paths // between them. Nodes map[geom.Key]*Node // Enemies stores rolled enemy squad locations and their types. Enemies map[geom.Key][]*game.Character // Start stores the rolled location for where the player should start in // this overworld map. Start geom.Key // Gate stores the location of the exit to this overworld. Gate geom.Key }
Map of an overworld.
func (*Map) SortedNodeKeys ¶
SortedNodeKeys provides the geom.Keys that appear in the Nodes map, sorted by M, then N.
type Node ¶
type Node struct { ID geom.Key // Connected neighbors mapped by the direction they lie. Connected map[geom.DirectionType]geom.Key // contains filtered or unexported fields }
Node is a stop on the overworld that might be occupied by the player, an encounter with an enemy squad, the escape portal, a merchant, etc, or nothing at all.
type Recipe ¶
type Recipe struct { Label string // Terrain stores the visible tiles of an overworld. Terrain map[geom.Key]TileID // Paths between nodes that are permitted to be generated. Paths []KeyPair // Interesting stores locations in the map that should always be included as // part of the generated Nodes. Interesting []InterestRoll }
Recipe stores configuration of how to roll a map.
type State ¶
type State int
State enumerates the States that an Overworld could be in.
const ( // Uninitialised is before the overworld Manager has been Begun(). Uninitialised State = iota // AnimatingState is when a squad is moving. AnimatingState // AwaitingInputState is when the Overworld is waiting for the local, human player to move their Squad. AwaitingInputState // FadingIn is when the combat is first starting, or returning from a menu, // and the curtain that obscures the scene change is disappearing. FadingIn //FadingOut is when the combat is going to another scene, and the curtain //that obscures the scene change is appearing. FadingOut )
type Token ¶
type Token struct { Key geom.Key Presence ecs.Entity // type? Squad, Gate, Merchant, etc? Category TokenType }
Token represents a presence on the overworld map. This might be an enemy Squad, the exit gate, a merchant, or rest stop.
type TokenMoved ¶
type TokenType ¶
type TokenType int
TokenType represents a category of owner for the Token. The values are unusual increments so that their sum can show which types collided.
type TokensCollided ¶
type Traversal ¶
type Traversal struct { Duration time.Duration Destination game.Center Complete func() // contains filtered or unexported fields }
Traversal is a Component that changes the X and Y coordinates of an Entity over time.