Documentation ¶
Index ¶
- Variables
- func CharacterPerformanceStrings() []string
- func CharacterSexStrings() []string
- func CombatResultStrings() []string
- func DamageTypeStrings() []string
- func MaxHealth(rawHealth, vitality int) int
- func StatTypeStrings() []string
- type Alpha
- type AnimationEndBehavior
- type AnimationSpeed
- type AnimationSystem
- type Appearance
- type Camera
- func (c *Camera) Center(x, y float64)
- func (c *Camera) GetH() int
- func (c *Camera) GetW() int
- func (c *Camera) GetX() float64
- func (c *Camera) GetY() float64
- func (c *Camera) GetZoom() float64
- func (c *Camera) Modulo(x, y int) (int, int)
- func (c *Camera) ScreenToWorld(sx, sy int) (wx, wy float64)
- func (c *Camera) SetX(x float64)
- func (c *Camera) SetY(y float64)
- func (c *Camera) SetZoom(zoom float64)
- func (c *Camera) Update(elapsed time.Duration)
- type Center
- type Character
- type CharacterPerformance
- type CharacterSex
- type CombatBegan
- type CombatConcluded
- type CombatMapRecipe
- type CombatMapRecipeHex
- type CombatMapRecipeHexFrame
- type CombatMapRecipeVisual
- type CombatResult
- type DamageType
- type DiagonalMatrixWipe
- type Facer
- type FadeIn
- type FadeOut
- type FadeSystem
- type FloatAwayAnimation
- type Font
- type FontSystem
- type Frame
- type FrameAnimation
- type Hidden
- type HoverAnimation
- type Leash
- type LeashSystem
- type Mastery
- type Obstacle
- type ObstacleType
- type Position
- type ProfessionDetails
- type RenderOffset
- type Scale
- type SceneWipeSystem
- type SomethingInteresting
- type Sprite
- type SpriteRepeat
- type Squad
- type StatType
- type TakeDamageAnimation
- type Team
- type TeamControl
- type Tint
- type WindowSizeChanged
Constants ¶
This section is empty.
Variables ¶
var BigPortrait = 52
BigPortrait is the dimensions of the big portraits in the game.
var PortraitBGBig = []Sprite{ Sprite{ Texture: "portrait-backgrounds.png", X: 0, Y: 0, W: BigPortrait, H: BigPortrait, }, Sprite{ Texture: "portrait-backgrounds.png", X: BigPortrait, Y: 0, W: BigPortrait, H: BigPortrait, }, Sprite{ Texture: "portrait-backgrounds.png", X: BigPortrait * 2, Y: 0, W: BigPortrait, H: BigPortrait, }, Sprite{ Texture: "portrait-backgrounds.png", X: BigPortrait * 3, Y: 0, W: BigPortrait, H: BigPortrait, }, Sprite{ Texture: "portrait-backgrounds.png", X: 0, Y: BigPortrait, W: BigPortrait, H: BigPortrait, }, Sprite{ Texture: "portrait-backgrounds.png", X: BigPortrait, Y: BigPortrait, W: BigPortrait, H: BigPortrait, }, Sprite{ Texture: "portrait-backgrounds.png", X: BigPortrait * 2, Y: BigPortrait, W: BigPortrait, H: BigPortrait, }, Sprite{ Texture: "portrait-backgrounds.png", X: BigPortrait * 3, Y: BigPortrait, W: BigPortrait, H: BigPortrait, }, }
PortraitBGBig stores a list of portrait backgrounds for large icons.
var PortraitBGSmall = []Sprite{ Sprite{ Texture: "portrait-backgrounds.png", X: 0, Y: 208, W: SmallPortrait, H: SmallPortrait, }, Sprite{ Texture: "portrait-backgrounds.png", X: SmallPortrait, Y: 208, W: SmallPortrait, H: SmallPortrait, }, Sprite{ Texture: "portrait-backgrounds.png", X: SmallPortrait * 2, Y: 208, W: SmallPortrait, H: SmallPortrait, }, Sprite{ Texture: "portrait-backgrounds.png", X: SmallPortrait * 3, Y: 208, W: SmallPortrait, H: SmallPortrait, }, Sprite{ Texture: "portrait-backgrounds.png", X: 208, Y: 0, W: SmallPortrait, H: SmallPortrait, }, Sprite{ Texture: "portrait-backgrounds.png", X: 208, Y: SmallPortrait, W: SmallPortrait, H: SmallPortrait, }, Sprite{ Texture: "portrait-backgrounds.png", X: 208, Y: SmallPortrait * 2, W: SmallPortrait, H: SmallPortrait, }, Sprite{ Texture: "portrait-backgrounds.png", X: 208, Y: SmallPortrait * 3, W: SmallPortrait, H: SmallPortrait, }, }
PortraitBGSmall stores a list of portrait backgrounds for small icons.
var PortraitFrameBig = []Sprite{ Sprite{ Texture: "portrait-frames.png", X: 0, Y: 0, W: BigPortrait, H: BigPortrait, }, }
PortraitFrameBig stores a list of portrait frames for large icons.
var PortraitFrameSmall = []Sprite{ Sprite{ Texture: "portrait-frames.png", X: 0, Y: 208, W: SmallPortrait, H: SmallPortrait, }, }
PortraitFrameSmall stores a list of portrait frames for small icons.
var SmallPortrait = BigPortrait / 2
SmallPortrait is the dimensions of the small portraits in the game.
var TintPseudoBlack = Tint{R: 0x14, G: 0x1b, B: 0x27}
var TintPseudoWhite = Tint{R: 0xda, G: 0xe1, B: 0xe5}
Functions ¶
func CharacterPerformanceStrings ¶
func CharacterPerformanceStrings() []string
CharacterPerformanceStrings returns a slice of all String values of the enum
func CharacterSexStrings ¶
func CharacterSexStrings() []string
CharacterSexStrings returns a slice of all String values of the enum
func CombatResultStrings ¶
func CombatResultStrings() []string
CombatResultStrings returns a slice of all String values of the enum
func DamageTypeStrings ¶
func DamageTypeStrings() []string
DamageTypeStrings returns a slice of all String values of the enum
func StatTypeStrings ¶
func StatTypeStrings() []string
StatTypeStrings returns a slice of all String values of the enum
Types ¶
type Alpha ¶
type Alpha struct {
Value float64 // Value should be between 0.0 and 1.0
}
Alpha is a component that controls how visible an Entity should be rendered.
type AnimationEndBehavior ¶
type AnimationEndBehavior int
AnimationEndBehavior is an enum that describes what happens when a FrameAnimation Component finishes all of its frames.
const ( // AnimationLoops means that the Animation will restart from the first frame // after the last frame expires. AnimationLoops AnimationEndBehavior = iota // HoldLastFrame means that the Animation will run through all frames, and // then stick on the last frame, removing the FrameAnimation Component. HoldLastFrame // DestroyEntity means that after the Animation is complete, the Entity that // owns it is destroyed. DestroyEntity )
type AnimationSpeed ¶
type AnimationSpeed struct {
Speed float64
}
AnimationSpeed changes the rate at which Animtions are animated. A value of 1.0 is normal speed, and a value of 0.0 would mean that the animation never progresses from the first frame. 0.5 would animate at half speed.
type AnimationSystem ¶
type AnimationSystem struct {
// contains filtered or unexported fields
}
AnimationSystem animates the visual Components of Entities. It's not responsible for translating or mapping game concepts like "casting a spell" to the assignment of appropriate animation Components for that Entity.
type Appearance ¶
type Appearance struct { Participant Sprite `json:"participant"` FaceX int `json:"faceX"` FaceY int `json:"faceY"` FeetX int `json:"feetX"` FeetY int `json:"feetY"` }
Appearance is how a Character appears in combat.
func (*Appearance) BigIcon ¶
func (a *Appearance) BigIcon() Sprite
BigIcon creates a new Sprite to use as a 52 by 52 portrait.
func (*Appearance) SmallIcon ¶
func (a *Appearance) SmallIcon() Sprite
SmallIcon creates a new Sprite to use as a 26 by 26 portrait.
type Camera ¶
type Camera struct {
// contains filtered or unexported fields
}
Camera is a class that stores focus and zoom values
func (*Camera) Modulo ¶
Modulo an x,y screen coordinate so that things that are beyond the limits of the screen are wrapped around. Use case is when you want to display something aligned to the bottom of the screen, you can set a negative y coordinate, and Modulo will convert that to screen height - y.
func (*Camera) ScreenToWorld ¶
ScreenToWorld translates screen coordinates to world coordinates based on the current zoom and focus values.
type Character ¶
type Character struct { // Things that don't affect gameplay. Name string Skin string Hair string PortraitBG int PortraitFrame int // Intrinsic to the Character Profession string Sex CharacterSex // InherantPreparation is the preparation value that this Character has as a // base, before values from their profession and equipped weapon are // applied. InherantPreparation int // InherantActionPoints is the base ActionPoints that this character has // before values from their profession and equipped weapon are applied. InherantActionPoints int CurrentHealth int BaseHealth int Level int StrengthPerLevel float64 AgilityPerLevel float64 IntelligencePerLevel float64 VitalityPerLevel float64 Disambiguator float64 // random number to order Characters when their Preparation etc collide. // Masteries indexed by the enum value. Masteries map[Mastery]int }
Character represents a character at the run level, and persists until the run is over.
type CharacterPerformance ¶
type CharacterPerformance int
const ( PerformIdle CharacterPerformance = iota PerformMove PerformSkill1 PerformSkill2 PerformSkill3 PerformHurt PerformDying PerformVictory )
func CharacterPerformanceString ¶
func CharacterPerformanceString(s string) (CharacterPerformance, error)
CharacterPerformanceString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.
func CharacterPerformanceValues ¶
func CharacterPerformanceValues() []CharacterPerformance
CharacterPerformanceValues returns all values of the enum
func (CharacterPerformance) IsACharacterPerformance ¶
func (i CharacterPerformance) IsACharacterPerformance() bool
IsACharacterPerformance returns "true" if the value is listed in the enum definition. "false" otherwise
func (CharacterPerformance) MarshalJSON ¶
func (i CharacterPerformance) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaler interface for CharacterPerformance
func (CharacterPerformance) String ¶
func (i CharacterPerformance) String() string
func (*CharacterPerformance) UnmarshalJSON ¶
func (i *CharacterPerformance) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaler interface for CharacterPerformance
type CharacterSex ¶
type CharacterSex int
CharacterSex is not CharacterGender, NB.
const ( Male CharacterSex = iota Female )
CharacterSexes only have two values. They represent XY and XX chromosomes.
func CharacterSexString ¶
func CharacterSexString(s string) (CharacterSex, error)
CharacterSexString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.
func CharacterSexValues ¶
func CharacterSexValues() []CharacterSex
CharacterSexValues returns all values of the enum
func (CharacterSex) IsACharacterSex ¶
func (i CharacterSex) IsACharacterSex() bool
IsACharacterSex returns "true" if the value is listed in the enum definition. "false" otherwise
func (CharacterSex) MarshalJSON ¶
func (i CharacterSex) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaler interface for CharacterSex
func (CharacterSex) String ¶
func (i CharacterSex) String() string
func (*CharacterSex) UnmarshalJSON ¶
func (i *CharacterSex) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaler interface for CharacterSex
type CombatConcluded ¶
type CombatConcluded struct {
Results map[ecs.Entity]CombatResult
}
CombatConcluded occurs when a Combat is over.
type CombatMapRecipe ¶
type CombatMapRecipe struct { Hexes []CombatMapRecipeHex Starts []geom.Key TileW, TileH int }
type CombatMapRecipeHex ¶
type CombatMapRecipeHex struct { Position geom.Key Obstacle ObstacleType Visuals []CombatMapRecipeVisual }
type CombatMapRecipeHexFrame ¶
type CombatMapRecipeVisual ¶
type CombatMapRecipeVisual struct { Frames []CombatMapRecipeHexFrame XOffset, YOffset int Layer int Obscures []geom.Key }
type CombatResult ¶
type CombatResult int
const ( Victorious CombatResult = iota Defeated Escaped )
func CombatResultString ¶
func CombatResultString(s string) (CombatResult, error)
CombatResultString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.
func CombatResultValues ¶
func CombatResultValues() []CombatResult
CombatResultValues returns all values of the enum
func (CombatResult) IsACombatResult ¶
func (i CombatResult) IsACombatResult() bool
IsACombatResult returns "true" if the value is listed in the enum definition. "false" otherwise
func (CombatResult) String ¶
func (i CombatResult) String() string
type DamageType ¶
type DamageType int
const ( PhysicalDamage DamageType = iota MagicalDamage FireDamage )
func DamageTypeString ¶
func DamageTypeString(s string) (DamageType, error)
DamageTypeString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.
func DamageTypeValues ¶
func DamageTypeValues() []DamageType
DamageTypeValues returns all values of the enum
func (DamageType) IsADamageType ¶
func (i DamageType) IsADamageType() bool
IsADamageType returns "true" if the value is listed in the enum definition. "false" otherwise
func (DamageType) MarshalJSON ¶
func (i DamageType) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaler interface for DamageType
func (DamageType) String ¶
func (i DamageType) String() string
func (*DamageType) UnmarshalJSON ¶
func (i *DamageType) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaler interface for DamageType
type DiagonalMatrixWipe ¶
type DiagonalMatrixWipe struct {
W, H int
Obscuring bool
OnComplete func()
OnInitialised func() // Useful for a !Obscuring to load stuff while the screen is hidden.
// contains filtered or unexported fields
}
DiagonalMatrixWipe obscures the scene by animating in squares of curtain in a diagonal pattern.
type Facer ¶
type Facer struct {
Face geom.DirectionType
}
Facer is a Component that represents a direction to face in.
type FadeSystem ¶
type FadeSystem struct{}
FadeSystem controls the Alpha Component of Entities by managing FadeOut and FadeIn Components.
type FloatAwayAnimation ¶
type FloatAwayAnimation struct { // Rate of floating away per second Rate float64 // contains filtered or unexported fields }
FloatAwayAnimation will offset the Entity upwards based on Rate as if it is a helium balloon floating away.
type FontSystem ¶
type FontSystem struct {
// contains filtered or unexported fields
}
FontSystem manages the synchronization of Font Components to their composing child entities.
func NewFontSystem ¶
func NewFontSystem(mgr *ecs.World) *FontSystem
NewFontSystem constructs a new FontSystem.
type FrameAnimation ¶
type FrameAnimation struct { Frames []Sprite Timings []time.Duration Pointer time.Duration // by default, loops forever // on end - maybe another animation, maybe a single frame, maybe some behaviour like trigger event EndBehavior AnimationEndBehavior }
FrameAnimation sets the Sprite of the Entity based on how far through the whole Animation is indicated by Pointer.
func NewFrameAnimationFromFrames ¶
func NewFrameAnimationFromFrames(frames []Frame) *FrameAnimation
NewFrameAnimationFromFrames creates a new animation from a slice of Frames.
func (*FrameAnimation) Duration ¶
func (fa *FrameAnimation) Duration() time.Duration
Duration of the entire Animation.
func (*FrameAnimation) Index ¶
func (fa *FrameAnimation) Index() int
Index returns the index of the Sprite that Pointer is currently pointing at. It returns -1 if Pointer is negative or the index of one past the last element when Pointer is outside the range of Timings.
func (*FrameAnimation) Randomise ¶
func (fa *FrameAnimation) Randomise() *FrameAnimation
Randomise the starting position of the Pointer.
type Hidden ¶
type Hidden struct{}
Hidden is a Component that prevents the Entity from being rendered.
type HoverAnimation ¶
type HoverAnimation struct{}
HoverAnimation makes the entity float up and down.
type LeashSystem ¶
type LeashSystem struct{}
LeashSystem synchronises the Position of Entities with a Leash Component to their Owner's Positions.
type Mastery ¶
type Mastery int
Mastery enumerates the types of Masteries or attunements that are available to Characters to learn on their journey.
const ( // ShortRangeMeleeMastery (Daggers, Swords, Clubs, etc) ShortRangeMeleeMastery Mastery = iota // LongRangeMeleeMastery (Spears and Polearms) LongRangeMeleeMastery // RangedCombatMastery (Bows, Slingshots, Javelins, etc) RangedCombatMastery // CraftsmanshipMastery relates to non-magical utility skills CraftsmanshipMastery // FireMastery for fire spells FireMastery // WaterMastery for water spells WaterMastery // EarthMastery for earth spells EarthMastery // AirMastery for air spells AirMastery // LightningMastery for Lightning spells LightningMastery // DarkMastery for unholy spells DarkMastery // LightMastery for holy spells LightMastery )
type Obstacle ¶
type Obstacle struct {
M, N int
ObstacleType ObstacleType
}
Obstacle is a Component that blocks a Hex.
type ObstacleType ¶
type ObstacleType int
ObstacleType is an enum.
const ( NonObstacle ObstacleType = iota CharacterObstacle CrevasseObstacle TreeObstacle DeepWaterObstacle MudObstacle )
ObstacleTypes represent the thing that is the obstacle. These might be static obstacle types, like a Tree or Rock, or another Character could be an Obstacle too.
func ParseObstacleType ¶
func ParseObstacleType(s string) (ObstacleType, error)
ParseObstacleType parses an ObstacleType from a string.
func (ObstacleType) String ¶
func (i ObstacleType) String() string
type Position ¶
type Position struct { Center Center Layer int // Absolute Positioned Components use screen coordinates, not world // coordinates. Absolute bool }
Position is a Component that anything with a position in the world has.
type ProfessionDetails ¶
type RenderOffset ¶
type RenderOffset struct {
X, Y int
}
RenderOffset is a value that offsets the position the Component should be rendered at. It can be used for visual effects or animations that should not affect the real Position of the Entity, just where it appears to be.
type Scale ¶
type Scale struct {
X, Y float64
}
Scale defines a multiplier that is applied to the Entity's size.
type SceneWipeSystem ¶
type SceneWipeSystem struct{}
SceneWipeSystem handles scene wipe Components that hide abrupt changes to the scene by fading in and out. Think of these as curtains that can be drawn to hide stage hands moving pieces of the set on and off the stage.
func NewSceneWipeSystem ¶
func NewSceneWipeSystem() *SceneWipeSystem
NewSceneWipeSystem constructs a SceneWipeSystem.
type SomethingInteresting ¶
type SomethingInteresting struct {
X, Y float64
}
SomethingInteresting occurs when something interesting has occurred. The camera may want to focus on X,Y.
type Sprite ¶
type Sprite struct { Texture string `json:"texture"` X int `json:"x"` Y int `json:"y"` W int `json:"w"` H int `json:"h"` // OffsetX and OffsetY exist as they can be applied to individual frames of // an animation. They do not duplicate the functionality of RenderOffset, as // that applies at the Entity level, and could effect the rendering position // of things that are not Sprites. (i.e shape primitives) OffsetX int `json:"offsetX"` OffsetY int `json:"offsetY"` }
Sprite is a renderable slice of a texture.
func (Sprite) AsAnimation ¶
func (s Sprite) AsAnimation() *FrameAnimation
AsAnimation wraps the Sprite in a FrameAnimation that only has a single frame. This is function is helpful when you have an interface that requires a FrameAnimation but you only want a single, static frame to be displayed.
type SpriteRepeat ¶
type SpriteRepeat struct {
W, H int
}
SpriteRepeat is a component that repeats (or "tiles") a sprite across a width and height.
type StatType ¶
type StatType int
func StatTypeString ¶
StatTypeString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.
func StatTypeValues ¶
func StatTypeValues() []StatType
StatTypeValues returns all values of the enum
func (StatType) IsAStatType ¶
IsAStatType returns "true" if the value is listed in the enum definition. "false" otherwise
type TakeDamageAnimation ¶
type TakeDamageAnimation struct {
// contains filtered or unexported fields
}
TakeDamageAnimation adds an offset that makes the Entity pendulum back and forth on the X axis as if they have been struck.
func (*TakeDamageAnimation) Type ¶
func (*TakeDamageAnimation) Type() string
Type of this Component.
type Team ¶
type Team struct { ID int64 Control TeamControl PedestalAppearance int }
Team is a Component that represents a grouping of Characters that work together, and share a source of control.
type TeamControl ¶
type TeamControl int
TeamControl marks the source of control.
const ( // LocalControl means that the player is controlling this team. LocalControl TeamControl = iota // NoControl is for things that do not move NoControl // ComputerControl means that an AI script is controlling this team. ComputerControl )
func (TeamControl) String ¶
func (i TeamControl) String() string
type Tint ¶
type Tint struct {
R, G, B uint8
}
Tint sets the color of the entity when it is rendered.
type WindowSizeChanged ¶
WindowSizeChanged occurs when the size of the window the game is running in changes.
Source Files ¶
- alpha.go
- animations.go
- camera.go
- character.go
- character_enumer.go
- combatMapRecipe.go
- damage.go
- damagetype_enumer.go
- events.go
- events_enumer.go
- facer.go
- fade.go
- font.go
- hidden.go
- leash.go
- mastery.go
- mastery_string.go
- obstacle.go
- obstacletype_string.go
- performances.go
- portrait.go
- position.go
- profession.go
- renderOffset.go
- scale.go
- sceneWipes.go
- sprite.go
- squad.go
- stats.go
- team.go
- teamcontrol_string.go
- tint.go
Directories ¶
Path | Synopsis |
---|---|
Package embark provides a Manager type to display a configuration mode to the player where they can design a squad to start a run with.
|
Package embark provides a Manager type to display a configuration mode to the player where they can design a squad to start a run with. |