game_map

package
v0.0.0-...-54c8723 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2021 License: GPL-3.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CharacterDefinitions map[string]CharacterDefinition = map[string]CharacterDefinition{
	"hero": {
		Id: "hero",
		Animations: map[string][]int{
			"up":    {16, 17, 18, 19},
			"right": {20, 21, 22, 23},
			"down":  {24, 25, 26, 27},
			"left":  {28, 29, 30, 31},
			// contains filtered or unexported fields
		},
		FacingDirection:    CharacterFacingDirection[2],
		EntityDef:          Entities["hero"],
		CombatEntityDef:    Entities["combat_hero"],
		DefaultState:       "wait",
		DefaultCombatState: csNpcStand,
	},
	"thief": {
		Id: "thief",
		Animations: map[string][]int{
			"up":    {96, 97, 98, 99},
			"right": {100, 101, 102, 103},
			"down":  {104, 105, 106, 107},
			"left":  {108, 109, 110, 111},

			"steal_1":       {41, 42, 43, 44, 45},
			"steal_2":       {15, 16, 17, 18, 19},
			"steal_3":       {20, 21, 22, 23, 24},
			"steal_4":       {45, 44, 43, 42, 41},
			"steal_success": {10, 11, 12, 13},
			"steal_failure": {10, 11, 12, 14},
			// contains filtered or unexported fields
		},
		FacingDirection:    CharacterFacingDirection[2],
		EntityDef:          Entities["thief"],
		CombatEntityDef:    Entities["combat_thief"],
		DefaultState:       "wait",
		DefaultCombatState: csNpcStand,
	},
	"mage": {
		Id: "mage",
		Animations: map[string][]int{
			"up":    {112, 113, 114, 115},
			"right": {116, 117, 118, 119},
			"down":  {120, 121, 122, 123},
			"left":  {124, 125, 126, 127},
			// contains filtered or unexported fields
		},
		FacingDirection: CharacterFacingDirection[2],
		EntityDef:       Entities["mage"],
		CombatEntityDef: Entities["combat_mage"],
		DefaultState:    "wait",
	},
	"sleeper": {
		Id: "sleeper",
		Animations: map[string][]int{
			"left": {13},
		},
		FacingDirection: CharacterFacingDirection[3],
		EntityDef:       Entities["hero"],
		CombatEntityDef: Entities["empty"],
		DefaultState:    "wait",
	},
	"npc1": {
		Id:              "npc1",
		FacingDirection: CharacterFacingDirection[2],
		EntityDef:       Entities["npc1"],
		CombatEntityDef: Entities["empty"],
		DefaultState:    "wait",
	},
	"npc2": {
		Id: "npc2",
		Animations: map[string][]int{
			"up": {48, 49, 50, 51}, "right": {52, 53, 54, 55}, "down": {56, 57, 58, 59}, "left": {60, 61, 62, 63},
		},
		FacingDirection: CharacterFacingDirection[2],
		EntityDef:       Entities["npc2"],
		CombatEntityDef: Entities["empty"],
		DefaultState:    "wait",
	},
	"guard": {
		Id: "guard",
		Animations: map[string][]int{
			"up": {48, 49, 50, 51}, "right": {52, 53, 54, 55}, "down": {56, 57, 58, 59}, "left": {60, 61, 62, 63},
		},
		FacingDirection: CharacterFacingDirection[2],
		EntityDef:       Entities["npc2"],
		CombatEntityDef: Entities["empty"],
		DefaultState:    "wait",
	},
	"prisoner": {
		Id: "prisoner",
		Animations: map[string][]int{
			"up": {80, 81, 82, 83}, "right": {84, 85, 86, 87}, "down": {88, 89, 90, 91}, "left": {92, 93, 94, 95},
		},
		FacingDirection: CharacterFacingDirection[2],
		EntityDef:       Entities["prisoner"],
		CombatEntityDef: Entities["empty"],
		DefaultState:    "wait",
	},
	"chest": {
		Id: "chest",
		Animations: map[string][]int{
			"down": {0, 1},
		},
		FacingDirection: CharacterFacingDirection[2],
		EntityDef:       Entities["chest"],
		CombatEntityDef: Entities["empty"],
	},
	"goblin": {
		Id:                 "goblin",
		FacingDirection:    CharacterFacingDirection[2],
		EntityDef:          Entities["goblin"],
		DefaultState:       "wait",
		DefaultCombatState: csStandby,
		Animations: map[string][]int{
			// contains filtered or unexported fields
		},
	},
	"ogre": {
		Id:                 "ogre",
		FacingDirection:    CharacterFacingDirection[2],
		EntityDef:          Entities["ogre"],
		DefaultState:       "wait",
		DefaultCombatState: csStandby,
	},
	"dragon": {
		Id:                 "dragon",
		FacingDirection:    CharacterFacingDirection[2],
		EntityDef:          Entities["dragon"],
		DefaultState:       "wait",
		DefaultCombatState: csStandby,
	},
}
View Source
var CharacterFacingDirection = [4]string{"up", "right", "down", "left"}
View Source
var Characters = map[string]func(gMap *GameMap) *Character{
	"hero":     hero,
	"thief":    thief,
	"mage":     mage,
	"sleeper":  Sleeper,
	"npc1":     NPC1,
	"npc2":     NPC2,
	"guard":    guard,
	"prisoner": prisoner,
	"chest":    chest,
}
View Source
var CombatActions = map[world.Action]func(state *CombatState, owner *combat.Actor, targets []*combat.Actor, defI interface{}){
	world.HpRestore:    HpRestore,
	world.MpRestore:    MpRestore,
	world.Revive:       Revive,
	world.ElementSpell: elementSpell,
}
View Source
var CombatSelector = CombatSelectorFunc{
	RandomAlivePlayer: RandomAlivePlayer,
	WeakestEnemy:      WeakestEnemy,
	SideEnemy:         SideEnemy,
	SelectAll:         SelectAll,
}
View Source
var CombatSelectorMap = map[string]func(state *CombatState) []*combat.Actor{
	world.RandomAlivePlayer: RandomAlivePlayer,
	world.WeakestEnemy:      WeakestEnemy,
	world.SideEnemy:         SideEnemy,
	world.SelectAll:         SelectAll,

	world.MostHurtEnemy: func(state *CombatState) []*combat.Actor {
		return WeakestActor(state.Actors[enemies], true)
	},
	world.MostHurtParty: func(state *CombatState) []*combat.Actor {
		return WeakestActor(state.Actors[party], true)
	},
	world.MostDrainedParty: func(state *CombatState) []*combat.Actor {
		return MostDrainedActor(state.Actors[party], true)
	},
	world.DeadParty: func(state *CombatState) []*combat.Actor {
		return DeadActors(state.Actors[party])
	},
}
View Source
var Entities = map[string]EntityDefinition{
	"empty": {
		Texture: "",
	},
	"combat_hero": {
		Texture: combatHeroPng,
		Width:   64, Height: 64,
		StartFrame: 10,
	},
	"combat_mage": {
		Texture: combatMagePng,
		Width:   64, Height: 64,
		StartFrame: 10,
	},
	"combat_thief": {
		Texture: combatThiefPng,
		Width:   64, Height: 64,
		StartFrame: 10,
	},
	"hero": {
		Texture: walkCyclePng,
		Width:   16, Height: 24,
		StartFrame: 24,
		TileX:      20,
		TileY:      20,
	},
	"thief": {
		Texture: walkCyclePng,
		Width:   16, Height: 24,
		StartFrame: 104,
		TileX:      11,
		TileY:      3,
	},
	"mage": {
		Texture: walkCyclePng,
		Width:   16, Height: 24,
		StartFrame: 120,
		TileX:      11,
		TileY:      3,
	},
	"goblin": {
		Texture: goblinPng,
		Width:   32, Height: 32,
		StartFrame: 0,
	},
	"ogre": {
		Texture: ogrePng,
		Width:   64, Height: 64,
		StartFrame: 0,
	},
	"dragon": {
		Texture: greenDragonPng,
		Width:   128, Height: 64,
		StartFrame: 0,
	},
	"sleeper": {
		Texture: sleepingPng,
		Width:   32, Height: 32,
		StartFrame: 12,
		TileX:      14,
		TileY:      19,
	},
	"npc1": {
		Texture: walkCyclePng,
		Width:   16, Height: 24,
		StartFrame: 46,
		TileX:      24,
		TileY:      19,
	},
	"npc2": {
		Texture: walkCyclePng,
		Width:   16, Height: 24,
		StartFrame: 56,
		TileX:      19,
		TileY:      24,
	},
	"prisoner": {
		Texture: walkCyclePng,
		Width:   16, Height: 24,
		StartFrame: 88,
		TileX:      19,
		TileY:      19,
	},
	"chest": {
		Texture: chestPng,
		Width:   16, Height: 16,
		StartFrame: 0,
		TileX:      20,
		TileY:      20,
	},
	"slash": {
		Texture: combatSlashPng,
		Width:   64, Height: 64,
		StartFrame: 2,
		Frames:     []int{2, 1, 0},
	},
	"claw": {
		Texture: combatClawPng,
		Width:   64, Height: 64,
		StartFrame: 0,
		Frames:     []int{0, 1, 2},
	},
	"fx_restore_hp": {
		Texture:    fxRestoreHpPng,
		Width:      16,
		Height:     16,
		StartFrame: 0,
		Frames:     []int{0, 1, 2, 3, 4},
	},
	"fx_restore_mp": {
		Texture:    fxRestoreMpPng,
		Width:      16,
		Height:     16,
		StartFrame: 0,
		Frames:     []int{0, 1, 2, 3, 4, 5},
	},
	"fx_revive": {
		Texture:    fxRevivePng,
		Width:      16,
		Height:     16,
		StartFrame: 0,
		Frames:     []int{0, 1, 2, 3, 4, 5, 6, 7},
	},
	"fx_use_item": {
		Texture:    fxUseItemPng,
		Width:      16,
		Height:     16,
		StartFrame: 0,
		Frames:     []int{0, 1, 2, 3, 3, 2, 1, 0},
	},
	"fx_fire": {
		Texture:    fxFirePng,
		Width:      32,
		Height:     48,
		StartFrame: 1,
		Frames:     []int{0, 1, 2},
	},
	"fx_electric": {
		Texture:    fxElectricPng,
		Width:      32,
		Height:     16,
		StartFrame: 1,
		Frames:     []int{0, 1, 2},
	},
	"fx_ice_1": {
		Texture:    fxIcePng,
		Width:      16,
		Height:     16,
		StartFrame: 1,
		Frames:     []int{0, 1, 2, 3},
	},
	"fx_ice_2": {
		Texture:    fxIcePng,
		Width:      16,
		Height:     16,
		StartFrame: 5,
		Frames:     []int{4, 5, 6, 7},
	},
	"fx_ice_3": {
		Texture:    fxIcePng,
		Width:      16,
		Height:     16,
		StartFrame: 9,
		Frames:     []int{8, 9, 10, 11},
	},
	"fx_ice_spark": {
		Texture:    fxIcePng,
		Width:      16,
		Height:     16,
		StartFrame: 13,
		Frames:     []int{12, 13, 14, 15},
	},
}

Entities

View Source
var Formula = FormulaT{
	MeleeAttack: meleeAttack,
	BaseAttack:  baseAttack,
	CalcDamage:  calcDamage,
	IsHit:       isHit,
	IsDodged:    isDodged,
	IsCountered: isCountered,
	CanFlee:     canFlee,
	Steal:       Steal,
}
View Source
var IntroScene = []interface{}{
	BlackScreen("blackscreen"),
	Wait(1),
	KillState("blackscreen"),
	PlayBGSound("../sound/rain.mp3"),
	TitleCaptionScreen("title", "Chandragupta Maurya", 3),
	SubTitleCaptionScreen("subtitle", "A jRPG game in GO", 2),
	KillState("title"),
	KillState("subtitle"),
	Scene("map_player_house", true, nil),
	RunActionAddNPC("map_player_house", "sleeper", 14, 19, 3),
	RunActionAddNPC("map_player_house", "guard", 19, 23, 0),
	PlaySound("../sound/door_break.mp3", 1),
	MoveNPC("guard", "map_player_house", []string{
		"up", "up", "up", "left", "left", "left",
	}),
	Say("map_player_house", "guard", "You are coming with me", 3),
	StopBGSound(),
	PlaySound("../sound/wagon.mp3", 4),
	BlackScreen("blackscreen"),
	Wait(3),
	KillState("blackscreen"),
	ReplaceScene("map_player_house", "map_jail", 31, 21, false, nil),
	Wait(1),
	Say("map_jail", "hero", "Where am I...", 2),
	Say("map_jail", "hero", "I should keep looking for ways out", 2),
	Wait(1),
	HandOffToMainStack("map_jail"),
}
View Source
var LIST = make(map[string]func(gMap *GameMap, a ...interface{}) func(b ...interface{}))
View Source
var MapsDB map[string]func(gStack *gui.StateStack) MapInfo

Functions

func ActionTeleport

func ActionTeleport(gMap *GameMap, a ...interface{}) func(entity *Entity)

ActionTeleport : *GameMap, Direction => *Entity => ()

func AddAnimEffect

func AddAnimEffect(state *CombatState, entity *Entity, fxEntityDef EntityDefinition, spf float64)

func AddNPC

func AddNPC(gMap *GameMap, x, y float64) func(char *Character)

func AddTextNumberEffect

func AddTextNumberEffect(state *CombatState, entity *Entity, num float64, hexColor string)

func ArenaStateCreate

func ArenaStateCreate(stack *gui.StateStack, prevState gui.StackInterface) gui.StackInterface

func BlackScreen

func BlackScreen(id string) func(storyboard *Storyboard) *WaitEvent

BlackScreen - end to call KillState("blackscreen") once done

func CSHurtCreate

func CSHurtCreate(args ...interface{}) state_machine.State

char *Character, cs *CombatState

func CSMoveCreate

func CSMoveCreate(args ...interface{}) state_machine.State

char *Character, cs *CombatState

func CSRunAnimCreate

func CSRunAnimCreate(args ...interface{}) state_machine.State

char *Character, cs *CombatState

func CSStandByCreate

func CSStandByCreate(args ...interface{}) state_machine.State

char *Character, cs *CombatState

func CalcSpellDamage

func CalcSpellDamage(state *CombatState, attacker, target *combat.Actor, spell world.SpecialItem) (damage float64)

func DeadActors

func DeadActors(actors []*combat.Actor) []*combat.Actor

func FadeOutCharacter

func FadeOutCharacter(mapName, npcId string, duration float64) func(storyboard *Storyboard) *TweenEvent

func FadeOutMap

func FadeOutMap(mapName string, duration float64) func(storyboard *Storyboard) *TweenEvent

func FollowPathStateCreate

func FollowPathStateCreate(args ...interface{}) state_machine.State

func HandOffToMainStack

func HandOffToMainStack(mapName string) func(storyboard *Storyboard) *WaitEvent

HandOffToMainStack will remove the exploreState from Storyboard and push it to main stack

func HpRestore

func HpRestore(state *CombatState, owner *combat.Actor, targets []*combat.Actor, defI interface{})

func KillState

func KillState(id string) func(storyboard *Storyboard) *WaitEvent

func MostDrainedActor

func MostDrainedActor(actors []*combat.Actor, onlyCheckDrained bool) []*combat.Actor

func MoveCamToTile

func MoveCamToTile(stateId string, fromTileX, fromTileY, tileX, tileY, duration float64) func(storyboard *Storyboard) *TweenEvent

MoveCamToTile not working as intended. pending

func MoveNPC

func MoveNPC(npcId, mapName string, path []string) func(storyboard *Storyboard) *BlockUntilEvent

func MoveStateCreate

func MoveStateCreate(args ...interface{}) state_machine.State

character *Character, gMap *GameMap

func MpRestore

func MpRestore(state *CombatState, owner *combat.Actor, targets []*combat.Actor, defI interface{})

func NPCStandCombatStateCreate

func NPCStandCombatStateCreate(args ...interface{}) state_machine.State

func NPCStandStateCreate

func NPCStandStateCreate(args ...interface{}) state_machine.State

func NPCStrollWaitStateCreate

func NPCStrollWaitStateCreate(args ...interface{}) state_machine.State

character *Character, gMap *GameMap

func PlayBGSound

func PlayBGSound(pathToSound string) func()

PlayBGSound will stop after track has finished

func PlaySound

func PlaySound(pathToSound string, duration float64) func(storyboard *Storyboard) *NonBlockingTimer

PlaySound will stop after the given duration

func RandomAlivePlayer

func RandomAlivePlayer(state *CombatState) []*combat.Actor

func RemoveState

func RemoveState(state gui.StackInterface) func(storyboard *Storyboard)

func ReplaceScene

func ReplaceScene(mapName string, newMapName string, tileX, tileY float64, hideHero bool, win *pixelgl.Window) func(storyboard *Storyboard) *NonBlockEvent

ReplaceScene will remove mapName and add newMapName with a Hero at given Tile X, Y

func ReplaceState

func ReplaceState(current, new gui.StackInterface) func(storyboard *Storyboard)

func Revive

func Revive(state *CombatState, owner *combat.Actor, targets []*combat.Actor, defI interface{})

func RunActionAddNPC

func RunActionAddNPC(mapName, entityDef string, x, y, seconds float64) func(storyboard *Storyboard) *WaitEvent

player_house, def = "sleeper", x = 14, y = 19

func RunFunction

func RunFunction(fn func()) func(storyboard *Storyboard) *WaitEvent

func RunScript

func RunScript(script func(gMap *GameMap, entity *Entity, x, y float64)) func(gMap *GameMap, entity *Entity, x, y float64)

func RunState

func RunState(stateMachine *state_machine.StateMachine, stateId string, params ...interface{}) func(storyboard *Storyboard) *BlockUntilEvent

func Say

func Say(mapName, npcId, textMessage string, time float64) func(storyboard *Storyboard) *TimedTextboxEvent

func Scene

func Scene(mapName string, hideHero bool, win *pixelgl.Window) func(storyboard *Storyboard) *NonBlockEvent

func SelectAll

func SelectAll(state *CombatState) []*combat.Actor

func SetHiddenTileVisible

func SetHiddenTileVisible(mapName string, tileX, tileY float64) func(storyboard *Storyboard) *WaitEvent

func SideEnemy

func SideEnemy(state *CombatState) []*combat.Actor

func StatsCharEntity

func StatsCharEntity(state *CombatState, actor *combat.Actor) (world.Stats, *Character, *Entity)

func Steal

func Steal(state *CombatState, attacker, target *combat.Actor) bool

func StopBGSound

func StopBGSound() func()

StopBGSound will pop out last queueBG item

func SubTitleCaptionScreen

func SubTitleCaptionScreen(id string, txt string, duration float64) func(storyboard *Storyboard) *TweenEvent

func TitleCaptionScreen

func TitleCaptionScreen(id string, txt string, duration float64) func(storyboard *Storyboard) *TweenEvent

func UpdateState

func UpdateState(state gui.StackInterface, time float64) func(storyboard *Storyboard) *TweenEvent

func WeakestActor

func WeakestActor(actors []*combat.Actor, onlyCheckHurt bool) []*combat.Actor

func WeakestEnemy

func WeakestEnemy(state *CombatState) []*combat.Actor

func WriteTile

func WriteTile(mapName string, tileX, tileY float64, collision bool) func(storyboard *Storyboard) *WaitEvent

Types

type Actors

type Actors struct {
	Party   []*combat.Actor
	Enemies []*combat.Actor
}

type AnimEntityFx

type AnimEntityFx struct {
	X, Y   float64
	Entity *Entity
	Anim   animation.Animation
	// contains filtered or unexported fields
}

func AnimEntityFxCreate

func AnimEntityFxCreate(x, y float64, entityDef EntityDefinition, frames []int, args ...interface{}) *AnimEntityFx

func (AnimEntityFx) IsFinished

func (f AnimEntityFx) IsFinished() bool

func (AnimEntityFx) Priority

func (f AnimEntityFx) Priority() int

func (*AnimEntityFx) Render

func (f *AnimEntityFx) Render(renderer pixel.Target)

func (*AnimEntityFx) Update

func (f *AnimEntityFx) Update(dt float64)

type ArenaCompleteState

type ArenaCompleteState struct {
	Stack *gui.StateStack
	// contains filtered or unexported fields
}

func ArenaCompleteStateCreate

func ArenaCompleteStateCreate(stack *gui.StateStack, prevState gui.StackInterface) *ArenaCompleteState

func (*ArenaCompleteState) Enter

func (s *ArenaCompleteState) Enter()

func (*ArenaCompleteState) Exit

func (s *ArenaCompleteState) Exit()

func (*ArenaCompleteState) HandleInput

func (s *ArenaCompleteState) HandleInput(win *pixelgl.Window)

func (*ArenaCompleteState) Render

func (s *ArenaCompleteState) Render(win *pixelgl.Window)

func (*ArenaCompleteState) Update

func (s *ArenaCompleteState) Update(dt float64) bool

type ArenaRound

type ArenaRound struct {
	Name    string
	Locked  bool
	Enemies []combat.ActorDef
}

type ArenaState

type ArenaState struct {
	Stack     *gui.StateStack
	World     *combat.WorldExtended
	Layout    gui.Layout
	Panels    []gui.Panel
	Selection *gui.SelectionMenu

	Rounds []*ArenaRound
	// contains filtered or unexported fields
}

func (*ArenaState) Enter

func (s *ArenaState) Enter()

func (*ArenaState) Exit

func (s *ArenaState) Exit()

func (*ArenaState) HandleInput

func (s *ArenaState) HandleInput(win *pixelgl.Window)

func (*ArenaState) LoseRound

func (s *ArenaState) LoseRound(index int, round *ArenaRound)

func (*ArenaState) OnRoundSelected

func (s *ArenaState) OnRoundSelected(index int, itemI interface{})

func (*ArenaState) Render

func (s *ArenaState) Render(renderer *pixelgl.Window)

func (*ArenaState) RenderRoundItem

func (s *ArenaState) RenderRoundItem(a ...interface{})

renderer pixel.Target, x, y float64, item ArenaRound

func (*ArenaState) Update

func (s *ArenaState) Update(dt float64) bool

func (*ArenaState) WinRound

func (s *ArenaState) WinRound(index int, round *ArenaRound)

type AttackOptions

type AttackOptions struct {
	Counter bool
}

type BarStats

type BarStats struct {
	HP, MP gui.ProgressBarIMD
}

type BlockUntilEvent

type BlockUntilEvent struct {
	UntilFunc func() bool
}

func BlockUntilEventCreate

func BlockUntilEventCreate(untilFunc func() bool) *BlockUntilEvent

func (BlockUntilEvent) IsBlocking

func (b BlockUntilEvent) IsBlocking() bool

func (BlockUntilEvent) IsFinished

func (b BlockUntilEvent) IsFinished() bool

func (BlockUntilEvent) Render

func (b BlockUntilEvent) Render(win *pixelgl.Window)

func (BlockUntilEvent) Update

func (b BlockUntilEvent) Update(dt float64)

type BrowseListState

type BrowseListState struct {
	Stack         *gui.StateStack
	X, Y          float64
	Width, Height float64
	Title         string
	OnFocus       func(item interface{})
	OnExit        func()
	Selection     *gui.SelectionMenu
	Box           gui.Panel

	UpArrow, DownArrow                 *pixel.Sprite
	UpArrowPosition, DownArrowPosition pixel.Vec
	// contains filtered or unexported fields
}

func BrowseListStateCreate

func BrowseListStateCreate(
	stack *gui.StateStack, x, y, width, height float64, title string, onFocus func(item interface{}), onExit func(), data interface{}, args ...interface{}) *BrowseListState

func (*BrowseListState) Enter

func (s *BrowseListState) Enter()

func (*BrowseListState) Exit

func (s *BrowseListState) Exit()

func (*BrowseListState) HandleInput

func (s *BrowseListState) HandleInput(win *pixelgl.Window)

func (*BrowseListState) Hide

func (s *BrowseListState) Hide()

func (*BrowseListState) Render

func (s *BrowseListState) Render(renderer *pixelgl.Window)

func (*BrowseListState) SetArrowPosition

func (s *BrowseListState) SetArrowPosition()

func (*BrowseListState) Show

func (s *BrowseListState) Show()

func (*BrowseListState) Update

func (s *BrowseListState) Update(dt float64) bool

type CEAttack

type CEAttack struct {
	Targets         []*combat.Actor
	Scene           *CombatState
	Finished        bool
	Character       *Character
	Storyboard      *Storyboard
	AttackEntityDef EntityDefinition
	DefaultTargeter func(state *CombatState) []*combat.Actor
	// contains filtered or unexported fields
}

func CEAttackCreate

func CEAttackCreate(scene *CombatState, owner *combat.Actor, targets []*combat.Actor, options AttackOptions) *CEAttack

func (CEAttack) CountDown

func (c CEAttack) CountDown() float64

func (*CEAttack) CountDownSet

func (c *CEAttack) CountDownSet(t float64)

func (*CEAttack) CounterTarget

func (c *CEAttack) CounterTarget(target *combat.Actor)

CounterTarget - Decide if the attack is countered.

func (*CEAttack) DoAttack

func (c *CEAttack) DoAttack()

func (*CEAttack) Execute

func (c *CEAttack) Execute(queue *EventQueue)

func (CEAttack) IsFinished

func (c CEAttack) IsFinished() bool

func (CEAttack) Name

func (c CEAttack) Name() string

func (CEAttack) Owner

func (c CEAttack) Owner() *combat.Actor

func (CEAttack) TimePoints

func (c CEAttack) TimePoints(queue *EventQueue) float64

func (CEAttack) Update

func (c CEAttack) Update()

type CECastSpell

type CECastSpell struct {
	Targets []*combat.Actor
	Scene   *CombatState

	Character  *Character
	Storyboard *Storyboard
	Spell      world.SpecialItem
	// contains filtered or unexported fields
}

func (*CECastSpell) CountDown

func (c *CECastSpell) CountDown() float64

func (*CECastSpell) CountDownSet

func (c *CECastSpell) CountDownSet(t float64)

func (*CECastSpell) DoCast

func (c *CECastSpell) DoCast()

func (*CECastSpell) DoFinish

func (c *CECastSpell) DoFinish()

func (*CECastSpell) Execute

func (c *CECastSpell) Execute(queue *EventQueue)

func (*CECastSpell) HideSpellNotice

func (c *CECastSpell) HideSpellNotice()

func (*CECastSpell) IsFinished

func (c *CECastSpell) IsFinished() bool

func (*CECastSpell) Name

func (c *CECastSpell) Name() string

func (*CECastSpell) Owner

func (c *CECastSpell) Owner() *combat.Actor

func (*CECastSpell) ShowSpellNotice

func (c *CECastSpell) ShowSpellNotice()

func (CECastSpell) TimePoints

func (c CECastSpell) TimePoints(queue *EventQueue) float64

func (*CECastSpell) Update

func (c *CECastSpell) Update()

type CEFlee

type CEFlee struct {
	Scene     *CombatState
	Character *Character

	FleeParams CSMoveParams
	CanFlee    bool
	Storyboard *Storyboard
	// contains filtered or unexported fields
}

func CEFleeCreate

func CEFleeCreate(scene *CombatState, owner *combat.Actor, fleeParams CSMoveParams) *CEFlee

func (CEFlee) CountDown

func (c CEFlee) CountDown() float64

func (*CEFlee) CountDownSet

func (c *CEFlee) CountDownSet(t float64)

func (*CEFlee) DoFleeSuccess

func (c *CEFlee) DoFleeSuccess()

func (*CEFlee) Execute

func (c *CEFlee) Execute(queue *EventQueue)

func (CEFlee) IsFinished

func (c CEFlee) IsFinished() bool

func (CEFlee) Name

func (c CEFlee) Name() string

func (*CEFlee) OnFleeFail

func (c *CEFlee) OnFleeFail()

func (CEFlee) Owner

func (c CEFlee) Owner() *combat.Actor

func (CEFlee) TimePoints

func (c CEFlee) TimePoints(queue *EventQueue) float64

func (*CEFlee) Update

func (c *CEFlee) Update()

type CESlash

type CESlash struct {
	SpecialItem     world.SpecialItem
	Targets         []*combat.Actor
	Scene           *CombatState
	Character       *Character
	Storyboard      *Storyboard
	AttackEntityDef EntityDefinition
	DefaultTargeter func(state *CombatState) []*combat.Actor
	// contains filtered or unexported fields
}

func (*CESlash) AttackTarget

func (c *CESlash) AttackTarget(target *combat.Actor)

func (*CESlash) CountDown

func (c *CESlash) CountDown() float64

func (*CESlash) CountDownSet

func (c *CESlash) CountDownSet(t float64)

func (*CESlash) CounterTarget

func (c *CESlash) CounterTarget(target *combat.Actor)

func (*CESlash) DoAttack

func (c *CESlash) DoAttack()

func (*CESlash) Execute

func (c *CESlash) Execute(queue *EventQueue)

func (*CESlash) IsFinished

func (c *CESlash) IsFinished() bool

func (*CESlash) Name

func (c *CESlash) Name() string

func (*CESlash) OnFinish

func (c *CESlash) OnFinish()

func (*CESlash) Owner

func (c *CESlash) Owner() *combat.Actor

func (*CESlash) ShowNotice

func (c *CESlash) ShowNotice()

func (*CESlash) TimePoints

func (c *CESlash) TimePoints(queue *EventQueue) float64

func (*CESlash) Update

func (c *CESlash) Update()

type CESteal

type CESteal struct {
	Success bool

	SpecialItem     world.SpecialItem
	Targets         []*combat.Actor
	Scene           *CombatState
	Character       *Character
	Storyboard      *Storyboard
	AttackEntityDef EntityDefinition
	DefaultTargeter func(state *CombatState) []*combat.Actor
	OriginalPos     pixel.Vec
	// contains filtered or unexported fields
}

func (*CESteal) CountDown

func (c *CESteal) CountDown() float64

func (*CESteal) CountDownSet

func (c *CESteal) CountDownSet(t float64)

func (*CESteal) DoSteal

func (c *CESteal) DoSteal()

func (*CESteal) Execute

func (c *CESteal) Execute(queue *EventQueue)

func (*CESteal) HideNotice

func (c *CESteal) HideNotice()

func (*CESteal) IsFinished

func (c *CESteal) IsFinished() bool

func (*CESteal) Name

func (c *CESteal) Name() string

func (*CESteal) OnFinish

func (c *CESteal) OnFinish()

func (*CESteal) Owner

func (c *CESteal) Owner() *combat.Actor

func (*CESteal) ShowNotice

func (c *CESteal) ShowNotice()

func (*CESteal) ShowResult

func (c *CESteal) ShowResult()

func (*CESteal) StealFrom

func (c *CESteal) StealFrom(target *combat.Actor) bool

func (*CESteal) TeleportIn

func (c *CESteal) TeleportIn()

func (*CESteal) TeleportOut

func (c *CESteal) TeleportOut()

func (*CESteal) TimePoints

func (c *CESteal) TimePoints(queue *EventQueue) float64

func (*CESteal) Update

func (c *CESteal) Update()

type CETurn

type CETurn struct {
	Scene *CombatState
	// contains filtered or unexported fields
}

CombatEventTurn

func CETurnCreate

func CETurnCreate(scene *CombatState, owner *combat.Actor) *CETurn

func (CETurn) CountDown

func (c CETurn) CountDown() float64

func (*CETurn) CountDownSet

func (c *CETurn) CountDownSet(t float64)

func (*CETurn) Execute

func (c *CETurn) Execute(queue *EventQueue)

func (CETurn) IsFinished

func (c CETurn) IsFinished() bool

func (CETurn) Name

func (c CETurn) Name() string

func (CETurn) Owner

func (c CETurn) Owner() *combat.Actor

func (CETurn) TimePoints

func (c CETurn) TimePoints(queue *EventQueue) float64

func (*CETurn) Update

func (c *CETurn) Update()

type CEUseItem

type CEUseItem struct {
	Scene     *CombatState
	Character *Character
	Targets   []*combat.Actor
	ItemDef   world.Item

	Storyboard *Storyboard
	// contains filtered or unexported fields
}

func CEUseItemCreate

func CEUseItemCreate(scene *CombatState, owner *combat.Actor, item world.Item, targets []*combat.Actor) *CEUseItem

func (*CEUseItem) CountDown

func (c *CEUseItem) CountDown() float64

func (*CEUseItem) CountDownSet

func (c *CEUseItem) CountDownSet(t float64)

func (*CEUseItem) DoFinish

func (c *CEUseItem) DoFinish()

func (*CEUseItem) DoUseItem

func (c *CEUseItem) DoUseItem()

func (*CEUseItem) Execute

func (c *CEUseItem) Execute(queue *EventQueue)

func (*CEUseItem) IsFinished

func (c *CEUseItem) IsFinished() bool

func (*CEUseItem) Name

func (c *CEUseItem) Name() string

func (*CEUseItem) Owner

func (c *CEUseItem) Owner() *combat.Actor

func (*CEUseItem) ShowItemNotice

func (c *CEUseItem) ShowItemNotice()

func (CEUseItem) TimePoints

func (c CEUseItem) TimePoints(queue *EventQueue) float64

func (*CEUseItem) Update

func (c *CEUseItem) Update()

type CSEnemyDie

type CSEnemyDie struct {
	Name        string
	Character   *Character
	CombatState *CombatState
	Entity      *Entity
	Tween       animation.Tween
}

csEnemyDie

func CSEnemyDieCreate

func CSEnemyDieCreate(args ...interface{}) *CSEnemyDie

char *Character, cs *CombatState

func (*CSEnemyDie) Enter

func (s *CSEnemyDie) Enter(data ...interface{})

func (*CSEnemyDie) Exit

func (s *CSEnemyDie) Exit()

func (*CSEnemyDie) IsFinished

func (s *CSEnemyDie) IsFinished() bool

func (*CSEnemyDie) Render

func (s *CSEnemyDie) Render(win *pixelgl.Window)

func (*CSEnemyDie) Update

func (s *CSEnemyDie) Update(dt float64)

type CSHurt

type CSHurt struct {
	Name        string
	Character   *Character
	CombatState *CombatState
	Entity      *Entity
	Anim        animation.Animation
	AnimId      string
	PrevState   state_machine.State
}

func (*CSHurt) Enter

func (s *CSHurt) Enter(data ...interface{})

func (*CSHurt) Exit

func (s *CSHurt) Exit()

func (CSHurt) IsFinished

func (s CSHurt) IsFinished() bool

func (*CSHurt) Render

func (s *CSHurt) Render(renderer *pixelgl.Window)

func (*CSHurt) Update

func (s *CSHurt) Update(dt float64)

type CSMove

type CSMove struct {
	Name                   string
	Character              *Character
	CombatState            *CombatState
	Entity                 *Entity
	Tween                  animation.Tween
	Anim                   animation.Animation
	AnimId                 string
	MoveTime, MoveDistance float64
	PixelX, PixelY         float64
}

func (*CSMove) Enter

func (s *CSMove) Enter(data ...interface{})

data = CSMoveParams

func (*CSMove) Exit

func (s *CSMove) Exit()

func (CSMove) IsFinished

func (s CSMove) IsFinished() bool

func (*CSMove) Render

func (s *CSMove) Render(renderer *pixelgl.Window)

func (*CSMove) Update

func (s *CSMove) Update(dt float64)

type CSMoveParams

type CSMoveParams struct {
	Dir, Distance, Time float64
}

type CSRunAnim

type CSRunAnim struct {
	Name        string
	Character   *Character
	CombatState *CombatState
	Entity      *Entity
	Anim        animation.Animation
	AnimId      string
}

func (*CSRunAnim) Enter

func (s *CSRunAnim) Enter(data ...interface{})

func (*CSRunAnim) Exit

func (s *CSRunAnim) Exit()

func (CSRunAnim) IsFinished

func (s CSRunAnim) IsFinished() bool

func (*CSRunAnim) Render

func (s *CSRunAnim) Render(renderer *pixelgl.Window)

func (*CSRunAnim) Update

func (s *CSRunAnim) Update(dt float64)

type CSStandBy

type CSStandBy struct {
	Name        string
	Character   *Character
	CombatState *CombatState
	Entity      *Entity
	Anim        animation.Animation
	AnimId      string
}

func (*CSStandBy) Enter

func (s *CSStandBy) Enter(data ...interface{})

func (*CSStandBy) Exit

func (s *CSStandBy) Exit()

func (CSStandBy) IsFinished

func (s CSStandBy) IsFinished() bool

func (*CSStandBy) Render

func (s *CSStandBy) Render(win *pixelgl.Window)

func (*CSStandBy) Update

func (s *CSStandBy) Update(dt float64)

type Character

type Character struct {
	Id                             string
	Anims                          map[string][]int
	Facing                         string
	Entity                         *Entity
	Controller                     *state_machine.StateMachine //[Name] -> [function that returns state]
	DefaultState, PrevDefaultState string                      //"wait"
	PathIndex                      int
	Path                           []string //e.g. ["up", "up", "up", "left", "right", "right",]
	TalkIndex                      int      //used during speech tracking
}

func CharacterCreate

func CharacterCreate(def CharacterDefinition, controllerStates map[string]func() state_machine.State) *Character

func NPC1

func NPC1(gMap *GameMap) *Character

func NPC2

func NPC2(gMap *GameMap) *Character

func Sleeper

func Sleeper(gMap *GameMap) *Character

func (*Character) FollowPath

func (ch *Character) FollowPath(path []string)

func (*Character) GetCombatAnim

func (ch *Character) GetCombatAnim(id string) []int

func (Character) GetFacedTileCoords

func (ch Character) GetFacedTileCoords() (x, y float64)

func (*Character) SetFacing

func (ch *Character) SetFacing(dir int)

type CharacterDefinition

type CharacterDefinition struct {
	Id                         string
	Animations                 map[string][]int
	FacingDirection            string
	EntityDef, CombatEntityDef EntityDefinition
	CombatStates               map[string]func(args ...interface{}) state_machine.State
	DefaultCombatState,
	DefaultState string
}

type CharacterStateBase

type CharacterStateBase struct {
	Character  *Character
	Map        *GameMap
	Entity     *Entity
	Controller *state_machine.StateMachine
}

type CombatCharacters

type CombatCharacters struct {
	Party   []*Character
	Enemies []*Character
}

type CombatChoiceParams

type CombatChoiceParams struct {
	OnSelect        func(targets []*combat.Actor)
	OnExit          func()
	SwitchSides     bool
	DefaultSelector func(state *CombatState) []*combat.Actor
	TargetType      world.CombatTargetType
}

type CombatChoiceState

type CombatChoiceState struct {
	Stack       *gui.StateStack //The internal stack of states from the CombatState object.
	CombatState *CombatState
	World       *combat.WorldExtended
	Actor       *combat.Actor
	Character   *Character
	UpArrow,
	DownArrow,
	Marker *pixel.Sprite
	UpArrowPosition,
	DownArrowPosition,
	MarkerPosition pixel.Vec

	Selection *gui.SelectionMenu
	// contains filtered or unexported fields
}

func CombatChoiceStateCreate

func CombatChoiceStateCreate(combatState *CombatState, owner *combat.Actor) *CombatChoiceState

func (*CombatChoiceState) CreateActionDialog

func (c *CombatChoiceState) CreateActionDialog(choices interface{})

func (*CombatChoiceState) CreateActionTargeter

func (c *CombatChoiceState) CreateActionTargeter(def world.SpecialItem, browseState *BrowseListState, combatEventF func(scene *CombatState, owner *combat.Actor, targets []*combat.Actor, spellI interface{}) CombatEvent) *CombatTargetState

func (*CombatChoiceState) CreateItemTargeter

func (c *CombatChoiceState) CreateItemTargeter(def world.Item, browseState *BrowseListState) *CombatTargetState

func (*CombatChoiceState) Enter

func (c *CombatChoiceState) Enter()

func (*CombatChoiceState) Exit

func (c *CombatChoiceState) Exit()

func (CombatChoiceState) HandleInput

func (c CombatChoiceState) HandleInput(win *pixelgl.Window)

func (*CombatChoiceState) Hide

func (c *CombatChoiceState) Hide()

func (*CombatChoiceState) OnItemAction

func (c *CombatChoiceState) OnItemAction()

func (*CombatChoiceState) OnMagicAction

func (c *CombatChoiceState) OnMagicAction()

func (*CombatChoiceState) OnSelect

func (c *CombatChoiceState) OnSelect(index int, str interface{})

func (*CombatChoiceState) OnSpecialAction

func (c *CombatChoiceState) OnSpecialAction()

func (CombatChoiceState) Render

func (c CombatChoiceState) Render(renderer *pixelgl.Window)

func (*CombatChoiceState) SetArrowPosition

func (c *CombatChoiceState) SetArrowPosition()

func (*CombatChoiceState) Show

func (c *CombatChoiceState) Show()

func (*CombatChoiceState) TakeAction

func (c *CombatChoiceState) TakeAction(id string, targets []*combat.Actor)

TakeAction function pops the CombatTargetState and CombatChoiceState off the stack. This leaves the CombatState internal stack empty and causes the EventQueue to start updating again.

func (*CombatChoiceState) Update

func (c *CombatChoiceState) Update(dt float64) bool

type CombatData

type CombatData struct {
	XP, Gold float64
	Loot     []world.ItemIndex
}

type CombatDef

type CombatDef struct {
	Background   string
	Actors       Actors
	Characters   CombatCharacters
	CanFlee      bool
	OnWin, OnDie func()
}

type CombatEvent

type CombatEvent interface {
	Name() string
	CountDown() float64
	CountDownSet(t float64)
	Owner() *combat.Actor
	Update()
	IsFinished() bool
	Execute(queue *EventQueue)
	TimePoints(queue *EventQueue) float64
}

CombatEvent (CE)

func CECastSpellCreate

func CECastSpellCreate(scene *CombatState, owner *combat.Actor, targets []*combat.Actor, spellI interface{}) CombatEvent

func CESlashCreate

func CESlashCreate(scene *CombatState, owner *combat.Actor, targets []*combat.Actor, specialI interface{}) CombatEvent

func CEStealCreate

func CEStealCreate(scene *CombatState, owner *combat.Actor, targets []*combat.Actor, specialI interface{}) CombatEvent

type CombatSelectorFunc

type CombatSelectorFunc struct {
	RandomAlivePlayer,
	WeakestEnemy,
	SideEnemy,
	SelectAll func(state *CombatState) []*combat.Actor
}

type CombatState

type CombatState struct {
	GameState     *gui.StateStack
	InternalStack *gui.StateStack

	Background       *pixel.Sprite
	BackgroundBounds pixel.Rect
	Pos              pixel.Vec
	Layout           gui.Layout
	LayoutMap        map[string][][]pixel.Vec
	Actors           map[string][]*combat.Actor
	Characters       map[string][]*Character
	DeathList        []*Character
	ActorCharMap     map[*combat.Actor]*Character
	SelectedActor    *combat.Actor
	EffectList       []EffectState
	Loot             []combat.ActorDropItem

	Panels []gui.Panel
	TipPanel,
	NoticePanel gui.Panel

	PanelTitles []PanelTitle
	PartyList,
	StatsList *gui.SelectionMenu
	//HP and MP columns in the bottom right panel
	StatsYCol float64
	Bars      map[*combat.Actor]BarStats //actor ID = BarStats

	EventQueue *EventQueue
	IsFinishing,
	Fled,
	CanFlee bool
	OnDieCallback, OnWinCallback func()
	// contains filtered or unexported fields
}

func CombatStateCreate

func CombatStateCreate(state *gui.StateStack, win *pixelgl.Window, def CombatDef) *CombatState

func (*CombatState) AddEffect

func (c *CombatState) AddEffect(fx EffectState)

func (*CombatState) AddTextEffect

func (c *CombatState) AddTextEffect(actor *combat.Actor, txt string, priority int)

func (*CombatState) AddTurns

func (c *CombatState) AddTurns(actorList []*combat.Actor)

func (*CombatState) ApplyCounter

func (c *CombatState) ApplyCounter(target, owner *combat.Actor)

func (*CombatState) ApplyDamage

func (c *CombatState) ApplyDamage(target *combat.Actor, damage float64, isCritical bool)

func (*CombatState) ApplyDodge

func (c *CombatState) ApplyDodge(target *combat.Actor)

func (*CombatState) ApplyMiss

func (c *CombatState) ApplyMiss(target *combat.Actor)

func (*CombatState) BuildBars

func (c *CombatState) BuildBars(actor *combat.Actor)

func (*CombatState) CalcCombatData

func (c *CombatState) CalcCombatData() CombatData

func (*CombatState) CreateCombatCharacters

func (c *CombatState) CreateCombatCharacters(key string)

func (*CombatState) DrawHP

func (c *CombatState) DrawHP(renderer pixel.Target, x, y float64, actor *combat.Actor)

func (*CombatState) DrawHpBarAtFeet

func (c *CombatState) DrawHpBarAtFeet(renderer pixel.Target, x, y float64, actor *combat.Actor)

func (*CombatState) DrawMP

func (c *CombatState) DrawMP(renderer pixel.Target, x, y float64, actor *combat.Actor)

func (CombatState) EnemyWins

func (c CombatState) EnemyWins() bool

func (*CombatState) Enter

func (c *CombatState) Enter()

func (*CombatState) Exit

func (c *CombatState) Exit()

func (CombatState) GetAlivePartyActors

func (c CombatState) GetAlivePartyActors() []*combat.Actor

func (*CombatState) GetTarget

func (c *CombatState) GetTarget(owner *combat.Actor) *combat.Actor

func (*CombatState) HandleDeath

func (c *CombatState) HandleDeath()

func (*CombatState) HandleEnemyDeath

func (c *CombatState) HandleEnemyDeath()

func (*CombatState) HandleInput

func (c *CombatState) HandleInput(win *pixelgl.Window)

func (*CombatState) HandlePartyDeath

func (c *CombatState) HandlePartyDeath()

func (CombatState) HasLiveActors

func (c CombatState) HasLiveActors(actorList []*combat.Actor) bool

func (*CombatState) HasPartyFled

func (c *CombatState) HasPartyFled() bool

func (*CombatState) HideNotice

func (c *CombatState) HideNotice()

func (*CombatState) HideTip

func (c *CombatState) HideTip()

func (CombatState) IsEnemyDefeated

func (c CombatState) IsEnemyDefeated() bool

func (CombatState) IsPartyDefeated

func (c CombatState) IsPartyDefeated() bool

IsPartyDefeated check's at least 1 Actor is standing return false

func (*CombatState) IsPartyMember

func (c *CombatState) IsPartyMember(owner *combat.Actor) bool

func (*CombatState) OnDead

func (c *CombatState) OnDead(actor *combat.Actor)

OnDead makes Actor KnockOut

func (*CombatState) OnFlee

func (c *CombatState) OnFlee()

func (*CombatState) OnLose

func (c *CombatState) OnLose()

func (*CombatState) OnPartyMemberSelect

func (c *CombatState) OnPartyMemberSelect(index int, str interface{})

func (*CombatState) OnWin

func (c *CombatState) OnWin()

func (CombatState) PartyWins

func (c CombatState) PartyWins() bool

func (CombatState) Render

func (c CombatState) Render(renderer *pixelgl.Window)

func (*CombatState) RenderPartyNames

func (c *CombatState) RenderPartyNames(args ...interface{})

func (*CombatState) RenderPartyStats

func (c *CombatState) RenderPartyStats(args ...interface{})

func (*CombatState) ShowNotice

func (c *CombatState) ShowNotice(txt string)

func (*CombatState) ShowTip

func (c *CombatState) ShowTip(txt string)

func (*CombatState) Update

func (c *CombatState) Update(dt float64) bool

type CombatTargetState

type CombatTargetState struct {
	CombatState     *CombatState
	Stack           *gui.StateStack                          //The internal stack of states from the CombatState object.
	DefaultSelector func(state *CombatState) []*combat.Actor //The function that chooses which characters are targeted
	//when the state begins.
	CanSwitchSide bool
	SelectType    world.CombatTargetType
	OnSelect      func(targets []*combat.Actor)
	OnExit        func()
	Targets,
	Enemies, Party []*combat.Actor
	MarkerPNG      pixel.Picture
	Marker         *pixel.Sprite
	MarkerPosition pixel.Vec
}

func CombatTargetStateCreate

func CombatTargetStateCreate(state *CombatState, choiceParams CombatChoiceParams) *CombatTargetState

func (*CombatTargetState) Down

func (t *CombatTargetState) Down()

func (*CombatTargetState) Enter

func (t *CombatTargetState) Enter()

func (*CombatTargetState) Exit

func (t *CombatTargetState) Exit()

func (CombatTargetState) GetActorList

func (t CombatTargetState) GetActorList(actor *combat.Actor) []*combat.Actor

func (CombatTargetState) GetIndex

func (t CombatTargetState) GetIndex(listI []*combat.Actor, item *combat.Actor) int

GetIndex finds Actors based on uniq names, since we might copy paste Enemies of same entity e.g. combat.ActorCreate(enemyDef, "1")

func (*CombatTargetState) HandleInput

func (t *CombatTargetState) HandleInput(win *pixelgl.Window)

func (*CombatTargetState) Left

func (t *CombatTargetState) Left()

func (*CombatTargetState) Render

func (t *CombatTargetState) Render(renderer *pixelgl.Window)

func (*CombatTargetState) Right

func (t *CombatTargetState) Right()

func (*CombatTargetState) Up

func (t *CombatTargetState) Up()

func (*CombatTargetState) Update

func (t *CombatTargetState) Update(dt float64) bool

type CombatTextFX

type CombatTextFX struct {
	X, Y                float64
	CurrentY, VelocityY float64
	Text                string
	Color               color.RGBA
	Gravity             float64
	Alpha               float64
	Scale               float64
	HoldTime            float64
	HoldCounter         float64
	FadeSpeed           float64
	// contains filtered or unexported fields
}

func CombatTextFXCreate

func CombatTextFXCreate(x, y float64, txt string, params ...interface{}) *CombatTextFX

func (*CombatTextFX) IsFinished

func (f *CombatTextFX) IsFinished() bool

func (*CombatTextFX) Priority

func (f *CombatTextFX) Priority() int

func (*CombatTextFX) Render

func (f *CombatTextFX) Render(renderer pixel.Target)

func (*CombatTextFX) Update

func (f *CombatTextFX) Update(dt float64)

type Direction

type Direction struct {
	X, Y float64
}

type EffectState

type EffectState interface {
	IsFinished() bool
	Update(dt float64)
	Render(renderer pixel.Target)
	Priority() int //0 is highest
}

IsFinished :Reports when the effect is finished so it can be removed from the list. Update: Updates the effect according to the elapsed frame time. Render :Renders the effect to the screen. Priority: Controls the render order. For instance, the jumping numbers should appear on top of everything else. Lower priority numbers are rendered later. 0 is considered the highest priority.

type Entity

type Entity struct {
	Sprite        *pixel.Sprite
	Texture       pixel.Picture
	Height, Width float64
	TileX, TileY  float64
	X, Y          float64 //used with Combat background image
	StartFrame    int
	Frames        []pixel.Rect
	Children      map[string]*Entity
}

Entity represents any kind of map object from a treasure chest to an NPC

func CreateEntity

func CreateEntity(def EntityDefinition) *Entity

func (*Entity) AddChild

func (e *Entity) AddChild(id string, entity *Entity)

func (*Entity) GetSelectPosition

func (e *Entity) GetSelectPosition() pixel.Vec

GetSelectPosition gets Head position minus offset

func (*Entity) GetTargetPosition

func (e *Entity) GetTargetPosition() pixel.Vec

func (Entity) GetTilePositionOnMap

func (e Entity) GetTilePositionOnMap(gMap *GameMap) (vec pixel.Vec)

func (*Entity) RemoveChild

func (e *Entity) RemoveChild(id string)

func (*Entity) Render

func (e *Entity) Render(gMap *GameMap, renderer pixel.Target, pos pixel.Vec)

Render will render self + any effects on entity e.g. SleepEntity

func (*Entity) SetFrame

func (e *Entity) SetFrame(frame int)

func (*Entity) SetTilePos

func (e *Entity) SetTilePos(x, y float64)

func (*Entity) TeleportAndDraw

func (e *Entity) TeleportAndDraw(gMap *GameMap, canvas *pixelgl.Canvas)

TeleportAndDraw hero SetTilePos

type EntityDefinition

type EntityDefinition struct {
	Texture       string
	Width, Height float64
	StartFrame    int
	Frames        []int //used for quick FX
	TileX, TileY  float64
}

type EquipMenuState

type EquipMenuState struct {
	Panels []gui.Panel
	Layout gui.Layout

	FilterMenus []*gui.SelectionMenu
	SlotMenu    *gui.SelectionMenu
	// contains filtered or unexported fields
}

func EquipMenuStateCreate

func EquipMenuStateCreate(parent *InGameMenuState, win *pixelgl.Window) *EquipMenuState

func (*EquipMenuState) DrawStat

func (e *EquipMenuState) DrawStat(renderer pixel.Target, x, y float64, label, statId string, diff float64)

func (*EquipMenuState) Enter

func (e *EquipMenuState) Enter(data ...interface{})

func (EquipMenuState) Exit

func (e EquipMenuState) Exit()

func (*EquipMenuState) FocusSlotMenu

func (e *EquipMenuState) FocusSlotMenu()

FocusSlotMenu - show Cursor on Item Slots (Top Right)

func (*EquipMenuState) GetSelectedItem

func (e *EquipMenuState) GetSelectedItem() int

func (EquipMenuState) GetSelectedSlot

func (e EquipMenuState) GetSelectedSlot() string

GetSelectedSlot takes index e.g. 3, returns "Accessory2"

func (EquipMenuState) IsFinished

func (e EquipMenuState) IsFinished() bool

func (*EquipMenuState) OnDoEquip

func (e *EquipMenuState) OnDoEquip(index int, itemIdxI interface{})

func (*EquipMenuState) OnEquipMenuChanged

func (e *EquipMenuState) OnEquipMenuChanged()

func (*EquipMenuState) OnSelectMenu

func (e *EquipMenuState) OnSelectMenu(i int, wItemTypeI interface{})

OnSelectMenu get trigger when user selects a Item Slot & then cursor should be visible in Inventory List (Bottom Right)

func (*EquipMenuState) RefreshFilteredMenus

func (e *EquipMenuState) RefreshFilteredMenus()

func (EquipMenuState) Render

func (e EquipMenuState) Render(renderer *pixelgl.Window)

func (*EquipMenuState) Update

func (e *EquipMenuState) Update(dt float64)

type EventQueue

type EventQueue struct {
	Queue        []CombatEvent
	CurrentEvent CombatEvent
}

func EventsQueueCreate

func EventsQueueCreate() *EventQueue

func (EventQueue) ActorHasEvent

func (q EventQueue) ActorHasEvent(actor *combat.Actor) bool

func (*EventQueue) Add

func (q *EventQueue) Add(eventI CombatEvent, timePoints float64)

func (*EventQueue) Clear

func (q *EventQueue) Clear()

func (EventQueue) IsEmpty

func (q EventQueue) IsEmpty() bool

func (EventQueue) Print

func (q EventQueue) Print()

Print just for debug

func (*EventQueue) RemoveEventsOwnedBy

func (q *EventQueue) RemoveEventsOwnedBy(actor *combat.Actor)

func (*EventQueue) Render

func (q *EventQueue) Render(win *pixelgl.Window)

func (EventQueue) SpeedToTimePoints

func (q EventQueue) SpeedToTimePoints(speed float64) float64

func (*EventQueue) Update

func (q *EventQueue) Update()

type ExploreState

type ExploreState struct {
	Stack  *gui.StateStack
	MapDef *tilepix.Map
	Map    *GameMap
	Hero   *Character

	FollowCam              bool
	FollowChar             *Character
	ManualCamX, ManualCamY float64
	// contains filtered or unexported fields
}

func ExploreStateCreate

func ExploreStateCreate(stack *gui.StateStack, mapInfo MapInfo, win *pixelgl.Window) ExploreState

func (*ExploreState) AddNPC

func (es *ExploreState) AddNPC(NPC *Character)

func (ExploreState) Enter

func (es ExploreState) Enter()

func (ExploreState) Exit

func (es ExploreState) Exit()

func (ExploreState) HandleInput

func (es ExploreState) HandleInput(win *pixelgl.Window)

func (*ExploreState) HideHero

func (es *ExploreState) HideHero()

func (ExploreState) Render

func (es ExploreState) Render(win *pixelgl.Window)

func (*ExploreState) SetFollowCam

func (es *ExploreState) SetFollowCam(shouldFollow bool, char *Character)

func (*ExploreState) SetManualCam

func (es *ExploreState) SetManualCam(tileX, tileY float64)

func (*ExploreState) ShowHero

func (es *ExploreState) ShowHero(tileX, tileY float64)

func (*ExploreState) Update

func (es *ExploreState) Update(dt float64) bool

func (*ExploreState) UpdateCamera

func (es *ExploreState) UpdateCamera(gMap *GameMap)

type FilterList

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

type FollowPathState

type FollowPathState struct {
	Character  *Character
	Map        GameMap
	Entity     Entity
	Controller *state_machine.StateMachine
}

func (*FollowPathState) Enter

func (s *FollowPathState) Enter(data ...interface{})

func (*FollowPathState) Exit

func (s *FollowPathState) Exit()

func (FollowPathState) IsFinished

func (s FollowPathState) IsFinished() bool

The StateMachine requires each state to have four functions: Enter, Exit, Render and Update

func (*FollowPathState) Render

func (s *FollowPathState) Render(win *pixelgl.Window)

func (*FollowPathState) Update

func (s *FollowPathState) Update(dt float64)

type FormulaT

type FormulaT struct {
	MeleeAttack      func(state *CombatState, attacker, target *combat.Actor) (dmg float64, hit HitResult)
	BaseAttack       func(state *CombatState, attacker, target *combat.Actor) (dmg float64)
	CalcDamage       func(state *CombatState, attacker, target *combat.Actor) (dmg float64)
	IsHit            func(state *CombatState, attacker, target *combat.Actor) HitResult
	IsDodged         func(state *CombatState, attacker, target *combat.Actor) bool
	IsCountered      func(state *CombatState, attacker, target *combat.Actor) bool
	CanFlee          func(state *CombatState, target *combat.Actor) bool
	MostHurtEnemy    func(state *CombatState) []*combat.Actor
	MostHurtParty    func(state *CombatState) []*combat.Actor
	MostDrainedParty func(state *CombatState) []*combat.Actor
	DeadParty        func(state *CombatState) []*combat.Actor
	Steal            func(state *CombatState, attacker, target *combat.Actor) bool
}

type FrontMenuState

type FrontMenuState struct {
	Parent                     *InGameMenuState
	Layout                     gui.Layout
	Stack                      *gui.StateStack
	World                      *combat.WorldExtended
	StateMachine               *state_machine.StateMachine
	TopBarText, PrevTopBarText string
	Selections                 *gui.SelectionMenu
	PartyMenu                  *gui.SelectionMenu
	Panels                     []gui.Panel

	InPartyMenu bool
	// contains filtered or unexported fields
}

func FrontMenuStateCreate

func FrontMenuStateCreate(parent *InGameMenuState, win *pixelgl.Window) *FrontMenuState

func (FrontMenuState) CreatePartySummaries

func (fm FrontMenuState) CreatePartySummaries() []combat.ActorSummary

func (FrontMenuState) Enter

func (fm FrontMenuState) Enter(data ...interface{})

func (FrontMenuState) Exit

func (fm FrontMenuState) Exit()

func (FrontMenuState) IsFinished

func (fm FrontMenuState) IsFinished() bool

StateMachine :: State impl below

func (*FrontMenuState) OnMenuClick

func (fm *FrontMenuState) OnMenuClick(index int, str interface{})

func (*FrontMenuState) OnPartyMemberChosen

func (fm *FrontMenuState) OnPartyMemberChosen(actorIndex int, actorSummaryI interface{})

func (FrontMenuState) Render

func (fm FrontMenuState) Render(renderer *pixelgl.Window)

func (*FrontMenuState) Update

func (fm *FrontMenuState) Update(dt float64)

type GameMap

type GameMap struct {

	// To track the camera position
	CamX, CamY float64

	MapInfo MapInfo

	Width, Height float64

	Tiles []*pixel.Batch

	TileWidth, TileHeight float64

	Canvas *pixelgl.Canvas

	Actions        map[string]func(gMap *GameMap, entity *Entity, x, y float64)
	TriggerTypes   map[string]Trigger
	Triggers       map[[2]float64]Trigger
	OnWakeTriggers map[string]Trigger

	Entities     []*Entity
	NPCs         []*Character
	NPCbyId      map[string]*Character
	MarkReRender bool
	// contains filtered or unexported fields
}

func MapCreate

func MapCreate(mapInfo MapInfo) *GameMap

func (*GameMap) AddNPC

func (m *GameMap) AddNPC(npc *Character)

AddNPC helps in detecting player if x,y has NPC or not

func (*GameMap) AddTrigger

func (m *GameMap) AddTrigger(id string, tileX, tileY float64)

func (*GameMap) ClearAllEntities

func (m *GameMap) ClearAllEntities()

func (GameMap) DrawAfter

func (m GameMap) DrawAfter(target pixel.Target, callback func(canvas *pixelgl.Canvas, layer int)) error

DrawAfter will render the callback function after given layer index uses pixelgl Canvas instead of Win to render

func (GameMap) GetEntityAtPos

func (m GameMap) GetEntityAtPos(x, y float64) *Entity

func (*GameMap) GetNPC

func (m *GameMap) GetNPC(tileX, tileY float64) *Character

func (GameMap) GetTileIndex

func (m GameMap) GetTileIndex(tileX, tileY float64) (x, y float64)

GetTileIndex will take TileX, TileY and return exact MAP cords e.g. 35, 22 will return cords on map x 400, y 1300

func (GameMap) GetTilePositionAtFeet

func (m GameMap) GetTilePositionAtFeet(x, y, charW, charH float64) pixel.Vec

func (GameMap) GetTrigger

func (m GameMap) GetTrigger(tileX, tileY float64) Trigger

func (*GameMap) GoToTile

func (m *GameMap) GoToTile(x, y float64)

Cam to Tile : GoToTile pan camera to given coordinates

func (*GameMap) Goto

func (m *GameMap) Goto(x, y float64)

func (GameMap) IsBlockingTile

func (m GameMap) IsBlockingTile(tileX, tileY int) bool

IsBlockingTile check's X, Y cords on collision map layer if ID is not 0, tile exists on X, Y we return true

func (*GameMap) RemoveNPC

func (m *GameMap) RemoveNPC(tileX, tileY float64) bool

func (*GameMap) RemoveTrigger

func (m *GameMap) RemoveTrigger(tileX, tileY float64)

RemoveTrigger accept actual Tiled App coordinates e.g. 35, 22

func (*GameMap) SetHiddenTileVisible

func (m *GameMap) SetHiddenTileVisible(tileX, tileY int)

SetHiddenTileVisible will set hideDecorationTile to true but actually we are setting decoration tile to hide so we can show Background layer tile below

func (*GameMap) SetTrigger

func (m *GameMap) SetTrigger(tileX, tileY float64, t Trigger)

func (*GameMap) WriteTile

func (m *GameMap) WriteTile(tileX, tileY float64, collision bool)

WriteTile - accept actual Tiled App coordinates e.g. 35, 22 it will bypassBlockedTile (removed collision)

type GameOverState

type GameOverState struct {
	Stack *gui.StateStack

	World *combat.WorldExtended
	Menu  *gui.SelectionMenu
	// contains filtered or unexported fields
}

func GameOverStateCreate

func GameOverStateCreate(stack *gui.StateStack) *GameOverState

func (*GameOverState) Enter

func (s *GameOverState) Enter()

func (GameOverState) Exit

func (s GameOverState) Exit()

func (*GameOverState) HandleInput

func (s *GameOverState) HandleInput(win *pixelgl.Window)

func (*GameOverState) OnSelection

func (s *GameOverState) OnSelection(index int, str interface{})

func (GameOverState) Render

func (s GameOverState) Render(renderer *pixelgl.Window)

func (*GameOverState) Update

func (s *GameOverState) Update(dt float64) bool

type HitResult

type HitResult int
const (
	HitResultMiss HitResult = iota
	HitResultDodge
	HitResultHit
	HitResultCritical
)

func IsHitMagic

func IsHitMagic(state *CombatState, attacker, target *combat.Actor, spell world.SpecialItem) HitResult

func MagicAttack

func MagicAttack(state *CombatState, attacker, target *combat.Actor, spell world.SpecialItem) (float64, HitResult)

type InGameMenuState

type InGameMenuState struct {
	Stack        *gui.StateStack
	StateMachine *state_machine.StateMachine
	World        *combat.WorldExtended
}

parent

func InGameMenuStateCreate

func InGameMenuStateCreate(stack *gui.StateStack, win *pixelgl.Window) *InGameMenuState

func (InGameMenuState) Enter

func (igm InGameMenuState) Enter()

func (InGameMenuState) Exit

func (igm InGameMenuState) Exit()

func (InGameMenuState) HandleInput

func (igm InGameMenuState) HandleInput(win *pixelgl.Window)

func (InGameMenuState) Render

func (igm InGameMenuState) Render(win *pixelgl.Window)

func (*InGameMenuState) Update

func (igm *InGameMenuState) Update(dt float64) bool

type ItemsMenuState

type ItemsMenuState struct {
	Layout         gui.Layout
	Stack          *gui.StateStack
	StateMachine   *state_machine.StateMachine
	Panels         []gui.Panel
	ItemMenus      []*gui.SelectionMenu
	CategoryMenu   *gui.SelectionMenu
	InCategoryMenu bool
	// contains filtered or unexported fields
}

func ItemsMenuStateCreate

func ItemsMenuStateCreate(parent *InGameMenuState, win *pixelgl.Window) *ItemsMenuState

func (ItemsMenuState) Enter

func (im ItemsMenuState) Enter(data ...interface{})

func (ItemsMenuState) Exit

func (im ItemsMenuState) Exit()

func (*ItemsMenuState) FocusOnCategoryMenu

func (im *ItemsMenuState) FocusOnCategoryMenu()

func (ItemsMenuState) IsFinished

func (im ItemsMenuState) IsFinished() bool

state_machine.State implemented below

func (*ItemsMenuState) OnCategorySelect

func (im *ItemsMenuState) OnCategorySelect(index int, value interface{})

func (ItemsMenuState) Render

func (im ItemsMenuState) Render(win *pixelgl.Window)

func (*ItemsMenuState) Update

func (im *ItemsMenuState) Update(dt float64)

type JumpingNumbersFX

type JumpingNumbersFX struct {
	X, Y, CurrentY, VelocityY,
	Number,
	Gravity,
	FadeDistance,
	Scale float64
	Color color.RGBA
	// contains filtered or unexported fields
}

func JumpingNumbersFXCreate

func JumpingNumbersFXCreate(x, y, number float64, params ...interface{}) *JumpingNumbersFX

func (*JumpingNumbersFX) IsFinished

func (f *JumpingNumbersFX) IsFinished() bool

func (*JumpingNumbersFX) Priority

func (f *JumpingNumbersFX) Priority() int

func (*JumpingNumbersFX) Render

func (f *JumpingNumbersFX) Render(renderer pixel.Target)

func (*JumpingNumbersFX) Update

func (f *JumpingNumbersFX) Update(dt float64)

type LootSummaryState

type LootSummaryState struct {
	Stack      *gui.StateStack
	CombatData CombatData
	World      *combat.WorldExtended
	Layout     gui.Layout
	Panels     []gui.Panel
	Loot       []world.ItemIndex
	Gold,
	GoldPerSec,
	GoldCounter float64
	IsCountingGold bool
	LootView       *gui.SelectionMenu
	OnWinCallback  func()
	// contains filtered or unexported fields
}

func LootSummaryStateCreate

func LootSummaryStateCreate(stack *gui.StateStack, win *pixelgl.Window, world *combat.WorldExtended, combatData CombatData, onWinCallback func()) *LootSummaryState

func (*LootSummaryState) Enter

func (s *LootSummaryState) Enter()

func (*LootSummaryState) Exit

func (s *LootSummaryState) Exit()

func (*LootSummaryState) HandleInput

func (s *LootSummaryState) HandleInput(win *pixelgl.Window)

func (*LootSummaryState) Render

func (s *LootSummaryState) Render(renderer *pixelgl.Window)

func (*LootSummaryState) RenderItem

func (s *LootSummaryState) RenderItem(a ...interface{})

func (*LootSummaryState) SkipCountingGold

func (s *LootSummaryState) SkipCountingGold()

func (*LootSummaryState) Update

func (s *LootSummaryState) Update(dt float64) bool

type MapAction

type MapAction struct {
	Id     string
	Script func(gameMap *GameMap, entity *Entity, x, y float64)
}

type MapInfo

type MapInfo struct {
	Tilemap                         *tilepix.Map
	CollisionLayer                  int
	CollisionLayerName, HiddenLayer string
	Actions                         map[string]MapAction   //"break_wall_script" : { Id = "RunScript", Scripts : []{ CrumbleScript } }
	TriggerTypes                    map[string]TriggerType //"cracked_stone" : { OnUse = "break_wall_script" }
	Triggers                        []TriggerParam         //[]{Id = "cracked_stone", x = 60, y = 11}
	OnWake                          map[string][]TriggerParam
}

type MoveState

type MoveState struct {
	Character  *Character
	Map        *GameMap
	Entity     *Entity
	Controller *state_machine.StateMachine
	// ^above common with WaitState
	TileWidth      float64
	MoveX, MoveY   float64
	PixelX, PixelY float64
	MoveSpeed      float64
	Tween          animation.Tween
	Anim           animation.Animation
}

func (*MoveState) Enter

func (s *MoveState) Enter(data ...interface{})

func (MoveState) Exit

func (s MoveState) Exit()

func (MoveState) IsFinished

func (s MoveState) IsFinished() bool

func (*MoveState) Render

func (s *MoveState) Render(win *pixelgl.Window)

func (*MoveState) Update

func (s *MoveState) Update(dt float64)

type NPCStrollWaitState

type NPCStrollWaitState struct {
	CharacterStateBase
	// contains filtered or unexported fields
}

func (*NPCStrollWaitState) Enter

func (s *NPCStrollWaitState) Enter(data ...interface{})

func (*NPCStrollWaitState) Exit

func (s *NPCStrollWaitState) Exit()

func (NPCStrollWaitState) IsFinished

func (s NPCStrollWaitState) IsFinished() bool

func (*NPCStrollWaitState) Render

func (s *NPCStrollWaitState) Render(win *pixelgl.Window)

func (*NPCStrollWaitState) Update

func (s *NPCStrollWaitState) Update(dt float64)

type NPCWaitState

type NPCWaitState struct {
	CharacterStateBase
	// contains filtered or unexported fields
}

func (*NPCWaitState) Enter

func (s *NPCWaitState) Enter(data ...interface{})

func (*NPCWaitState) Exit

func (s *NPCWaitState) Exit()

func (NPCWaitState) IsFinished

func (s NPCWaitState) IsFinished() bool

func (*NPCWaitState) Render

func (s *NPCWaitState) Render(win *pixelgl.Window)

func (*NPCWaitState) Update

func (s *NPCWaitState) Update(dt float64)

type NonBlockEvent

type NonBlockEvent struct {
	Seconds float64
}

func NonBlockEventCreate

func NonBlockEventCreate(seconds float64) *NonBlockEvent

func (NonBlockEvent) IsBlocking

func (e NonBlockEvent) IsBlocking() bool

func (NonBlockEvent) IsFinished

func (e NonBlockEvent) IsFinished() bool

func (NonBlockEvent) Render

func (e NonBlockEvent) Render(win *pixelgl.Window)

func (*NonBlockEvent) Update

func (e *NonBlockEvent) Update(dt float64)

type NonBlockingTimer

type NonBlockingTimer struct {
	Seconds   float64
	ApplyFunc func(e *NonBlockingTimer)
	HasPopOut bool
}

func NonBlockingTimerCreate

func NonBlockingTimerCreate(seconds float64, applyFunc func(e *NonBlockingTimer)) *NonBlockingTimer

func (NonBlockingTimer) IsBlocking

func (e NonBlockingTimer) IsBlocking() bool

func (NonBlockingTimer) IsFinished

func (e NonBlockingTimer) IsFinished() bool

func (NonBlockingTimer) Render

func (e NonBlockingTimer) Render(win *pixelgl.Window)

func (NonBlockingTimer) TimeUp

func (e NonBlockingTimer) TimeUp() bool

func (*NonBlockingTimer) Update

func (e *NonBlockingTimer) Update(dt float64)

type PanelTitle

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

type SBEvent

type SBEvent interface {
	Update(dt float64)
	IsBlocking() bool
	IsFinished() bool
	Render(win *pixelgl.Window)
}

type ScreenState

type ScreenState struct {
	Stack *gui.StateStack
	Color color.Color
}

func ScreenStateCreate

func ScreenStateCreate(stack *gui.StateStack, color color.Color) ScreenState

func (ScreenState) Enter

func (s ScreenState) Enter()

func (ScreenState) Exit

func (s ScreenState) Exit()

func (ScreenState) HandleInput

func (s ScreenState) HandleInput(win *pixelgl.Window)

func (ScreenState) Render

func (s ScreenState) Render(win *pixelgl.Window)

func (*ScreenState) SetW

func (s *ScreenState) SetW(value float64)

func (ScreenState) Update

func (s ScreenState) Update(dt float64) bool

type SleepState

type SleepState struct {
	Character           *Character
	Map                 *GameMap
	Entity, SleepEntity *Entity
	Controller          *state_machine.StateMachine
	Anim                animation.Animation
}

func SleepStateCreate

func SleepStateCreate(args ...interface{}) *SleepState

character *Character, gMap *GameMap

func (*SleepState) Enter

func (s *SleepState) Enter(data ...interface{})

func (*SleepState) Exit

func (s *SleepState) Exit()

func (SleepState) IsFinished

func (s SleepState) IsFinished() bool

func (*SleepState) Render

func (s *SleepState) Render(win *pixelgl.Window)

func (*SleepState) Update

func (s *SleepState) Update(dt float64)

type StatusMenuState

type StatusMenuState struct {
	Layout       gui.Layout
	Stack        *gui.StateStack
	StateMachine *state_machine.StateMachine
	TopBarText,
	PrevTopBarText string
	EquipMenu,
	Actions *gui.SelectionMenu
	Panels       []gui.Panel
	ActorSummary combat.ActorSummary
	// contains filtered or unexported fields
}

func StatusMenuStateCreate

func StatusMenuStateCreate(parent *InGameMenuState, win *pixelgl.Window) *StatusMenuState

func (StatusMenuState) DrawStat

func (s StatusMenuState) DrawStat(renderer pixel.Target, x, y float64, label string, value float64)

func (*StatusMenuState) Enter

func (s *StatusMenuState) Enter(data ...interface{})

func (StatusMenuState) Exit

func (s StatusMenuState) Exit()

func (StatusMenuState) IsFinished

func (s StatusMenuState) IsFinished() bool

/////////////////////////// StateMachine impl below //

func (StatusMenuState) Render

func (s StatusMenuState) Render(renderer *pixelgl.Window)

func (StatusMenuState) Update

func (s StatusMenuState) Update(dt float64)

type Storyboard

type Storyboard struct {
	Stack         *gui.StateStack
	InternalStack *gui.StateStack
	States        map[string]gui.StackInterface
	Events        []interface{} //always keep as last args
}

func StoryboardCreate

func StoryboardCreate(stack *gui.StateStack, win *pixelgl.Window, eventsI interface{}, handIn bool) *Storyboard

func (Storyboard) CleanUp

func (s Storyboard) CleanUp()

func (Storyboard) Enter

func (s Storyboard) Enter()

StateStack interface implemented below

func (Storyboard) Exit

func (s Storyboard) Exit()

func (Storyboard) HandleInput

func (s Storyboard) HandleInput(win *pixelgl.Window)

func (*Storyboard) PushState

func (s *Storyboard) PushState(identifier string, state gui.StackInterface)

func (*Storyboard) RemoveState

func (s *Storyboard) RemoveState(identifier string)

func (Storyboard) Render

func (s Storyboard) Render(win *pixelgl.Window)

func (*Storyboard) Update

func (s *Storyboard) Update(dt float64) bool

type TimedTextboxEvent

type TimedTextboxEvent struct {
	Textbox   *gui.Textbox
	Countdown float64
}

func TimedTextboxEventCreate

func TimedTextboxEventCreate(tbox *gui.Textbox, countDown float64) *TimedTextboxEvent

func (TimedTextboxEvent) IsBlocking

func (e TimedTextboxEvent) IsBlocking() bool

func (TimedTextboxEvent) IsFinished

func (e TimedTextboxEvent) IsFinished() bool

func (TimedTextboxEvent) Render

func (e TimedTextboxEvent) Render(win *pixelgl.Window)

func (*TimedTextboxEvent) Update

func (e *TimedTextboxEvent) Update(dt float64)

type Trigger

type Trigger struct {
	OnEnter func(gMap *GameMap, entity *Entity, x, y float64)
	OnExit  func(gMap *GameMap, entity *Entity, x, y float64)
	OnUse   func(gMap *GameMap, entity *Entity, x, y float64)
}

func TriggerCreate

func TriggerCreate(OnEnter func(gMap *GameMap, entity *Entity, x, y float64), OnExit func(gMap *GameMap, entity *Entity, x, y float64), OnUse func(gMap *GameMap, entity *Entity, x, y float64)) Trigger

TriggerCreate e.g. tileX, tileY = CastleRoomMap.GetTileIndex(9, 10)

CastleRoomMap.Triggers[[2]float64{tileX, tileY}].OnEnter(gHero.Entity)

type TriggerParam

type TriggerParam struct {
	Id   string
	X, Y float64
}

type TriggerType

type TriggerType struct {
	OnUse   string
	OnEnter string
	OnExit  string
}

type TweenEvent

type TweenEvent struct {
	Tween     animation.Tween
	Target    gui.StackInterface
	ApplyFunc func(e *TweenEvent)
}

func TweenEventCreate

func TweenEventCreate(start, finish, duration float64, target gui.StackInterface, applyFunc func(e *TweenEvent)) *TweenEvent

func (TweenEvent) IsBlocking

func (e TweenEvent) IsBlocking() bool

func (TweenEvent) IsFinished

func (e TweenEvent) IsFinished() bool

func (TweenEvent) Render

func (e TweenEvent) Render(win *pixelgl.Window)

func (*TweenEvent) Update

func (e *TweenEvent) Update(dt float64)

type WaitEvent

type WaitEvent struct {
	Seconds float64
}

func Wait

func Wait(seconds float64) *WaitEvent

func WaitEventCreate

func WaitEventCreate(seconds float64) *WaitEvent

func (WaitEvent) IsBlocking

func (e WaitEvent) IsBlocking() bool

func (WaitEvent) IsFinished

func (e WaitEvent) IsFinished() bool

func (WaitEvent) Render

func (e WaitEvent) Render(win *pixelgl.Window)

func (*WaitEvent) Update

func (e *WaitEvent) Update(dt float64)

type WaitState

type WaitState struct {
	Character  *Character
	Map        *GameMap
	Entity     *Entity
	Controller *state_machine.StateMachine

	FrameCount float64
	// contains filtered or unexported fields
}

func WaitStateCreate

func WaitStateCreate(args ...interface{}) *WaitState

character *Character, gMap *GameMap

func (*WaitState) Enter

func (s *WaitState) Enter(data ...interface{})

func (*WaitState) Exit

func (s *WaitState) Exit()

func (WaitState) IsFinished

func (s WaitState) IsFinished() bool

The StateMachine requires each state to have four functions: Enter, Exit, Render and Update

func (*WaitState) Render

func (s *WaitState) Render(win *pixelgl.Window)

func (*WaitState) Update

func (s *WaitState) Update(dt float64)

type XPSummaryState

type XPSummaryState struct {
	Stack      *gui.StateStack
	CombatData CombatData
	Layout     gui.Layout
	TitlePanels,
	ActorPanels []gui.Panel
	XP,
	XPcopy,
	XPPerSec,
	XPCounter float64
	IsCountingXP  bool
	Party         []*combat.Actor
	PartySummary  []*combat.ActorXPSummary
	OnWinCallback func()
	// contains filtered or unexported fields
}

func XPSummaryStateCreate

func XPSummaryStateCreate(stack *gui.StateStack, win *pixelgl.Window, party combat.Party, combatData CombatData, onWinCallback func()) *XPSummaryState

func (*XPSummaryState) ApplyXPToParty

func (s *XPSummaryState) ApplyXPToParty(xp float64)

func (XPSummaryState) ArePopUpsRemaining

func (s XPSummaryState) ArePopUpsRemaining() bool

func (*XPSummaryState) CloseNextPopUp

func (s *XPSummaryState) CloseNextPopUp()

func (*XPSummaryState) Enter

func (s *XPSummaryState) Enter()

func (*XPSummaryState) Exit

func (s *XPSummaryState) Exit()

func (*XPSummaryState) GotoLootSummary

func (s *XPSummaryState) GotoLootSummary()

func (*XPSummaryState) HandleInput

func (s *XPSummaryState) HandleInput(win *pixelgl.Window)

func (*XPSummaryState) Render

func (s *XPSummaryState) Render(renderer *pixelgl.Window)

func (*XPSummaryState) SkipCountingXP

func (s *XPSummaryState) SkipCountingXP()

func (*XPSummaryState) UnlockPopUps

func (s *XPSummaryState) UnlockPopUps(summary *combat.ActorXPSummary, levelUpActions map[string][]string)

func (*XPSummaryState) Update

func (s *XPSummaryState) Update(dt float64) bool

Jump to

Keyboard shortcuts

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