Documentation ¶
Index ¶
- Variables
- func ActionTeleport(gMap *GameMap, a ...interface{}) func(entity *Entity)
- func AddAnimEffect(state *CombatState, entity *Entity, fxEntityDef EntityDefinition, spf float64)
- func AddNPC(gMap *GameMap, x, y float64) func(char *Character)
- func AddTextNumberEffect(state *CombatState, entity *Entity, num float64, hexColor string)
- func ArenaStateCreate(stack *gui.StateStack, prevState gui.StackInterface) gui.StackInterface
- func BlackScreen(id string) func(storyboard *Storyboard) *WaitEvent
- func CSHurtCreate(args ...interface{}) state_machine.State
- func CSMoveCreate(args ...interface{}) state_machine.State
- func CSRunAnimCreate(args ...interface{}) state_machine.State
- func CSStandByCreate(args ...interface{}) state_machine.State
- func CalcSpellDamage(state *CombatState, attacker, target *combat.Actor, spell world.SpecialItem) (damage float64)
- func DeadActors(actors []*combat.Actor) []*combat.Actor
- func FadeOutCharacter(mapName, npcId string, duration float64) func(storyboard *Storyboard) *TweenEvent
- func FadeOutMap(mapName string, duration float64) func(storyboard *Storyboard) *TweenEvent
- func FollowPathStateCreate(args ...interface{}) state_machine.State
- func HandOffToMainStack(mapName string) func(storyboard *Storyboard) *WaitEvent
- func HpRestore(state *CombatState, owner *combat.Actor, targets []*combat.Actor, ...)
- func KillState(id string) func(storyboard *Storyboard) *WaitEvent
- func MostDrainedActor(actors []*combat.Actor, onlyCheckDrained bool) []*combat.Actor
- func MoveCamToTile(stateId string, fromTileX, fromTileY, tileX, tileY, duration float64) func(storyboard *Storyboard) *TweenEvent
- func MoveNPC(npcId, mapName string, path []string) func(storyboard *Storyboard) *BlockUntilEvent
- func MoveStateCreate(args ...interface{}) state_machine.State
- func MpRestore(state *CombatState, owner *combat.Actor, targets []*combat.Actor, ...)
- func NPCStandCombatStateCreate(args ...interface{}) state_machine.State
- func NPCStandStateCreate(args ...interface{}) state_machine.State
- func NPCStrollWaitStateCreate(args ...interface{}) state_machine.State
- func PlayBGSound(pathToSound string) func()
- func PlaySound(pathToSound string, duration float64) func(storyboard *Storyboard) *NonBlockingTimer
- func RandomAlivePlayer(state *CombatState) []*combat.Actor
- func RemoveState(state gui.StackInterface) func(storyboard *Storyboard)
- func ReplaceScene(mapName string, newMapName string, tileX, tileY float64, hideHero bool, ...) func(storyboard *Storyboard) *NonBlockEvent
- func ReplaceState(current, new gui.StackInterface) func(storyboard *Storyboard)
- func Revive(state *CombatState, owner *combat.Actor, targets []*combat.Actor, ...)
- func RunActionAddNPC(mapName, entityDef string, x, y, seconds float64) func(storyboard *Storyboard) *WaitEvent
- func RunFunction(fn func()) func(storyboard *Storyboard) *WaitEvent
- func RunScript(script func(gMap *GameMap, entity *Entity, x, y float64)) func(gMap *GameMap, entity *Entity, x, y float64)
- func RunState(stateMachine *state_machine.StateMachine, stateId string, ...) func(storyboard *Storyboard) *BlockUntilEvent
- func Say(mapName, npcId, textMessage string, time float64) func(storyboard *Storyboard) *TimedTextboxEvent
- func Scene(mapName string, hideHero bool, win *pixelgl.Window) func(storyboard *Storyboard) *NonBlockEvent
- func SelectAll(state *CombatState) []*combat.Actor
- func SetHiddenTileVisible(mapName string, tileX, tileY float64) func(storyboard *Storyboard) *WaitEvent
- func SideEnemy(state *CombatState) []*combat.Actor
- func StatsCharEntity(state *CombatState, actor *combat.Actor) (world.Stats, *Character, *Entity)
- func Steal(state *CombatState, attacker, target *combat.Actor) bool
- func StopBGSound() func()
- func SubTitleCaptionScreen(id string, txt string, duration float64) func(storyboard *Storyboard) *TweenEvent
- func TitleCaptionScreen(id string, txt string, duration float64) func(storyboard *Storyboard) *TweenEvent
- func UpdateState(state gui.StackInterface, time float64) func(storyboard *Storyboard) *TweenEvent
- func WeakestActor(actors []*combat.Actor, onlyCheckHurt bool) []*combat.Actor
- func WeakestEnemy(state *CombatState) []*combat.Actor
- func WriteTile(mapName string, tileX, tileY float64, collision bool) func(storyboard *Storyboard) *WaitEvent
- type Actors
- type AnimEntityFx
- type ArenaCompleteState
- type ArenaRound
- type ArenaState
- func (s *ArenaState) Enter()
- func (s *ArenaState) Exit()
- func (s *ArenaState) HandleInput(win *pixelgl.Window)
- func (s *ArenaState) LoseRound(index int, round *ArenaRound)
- func (s *ArenaState) OnRoundSelected(index int, itemI interface{})
- func (s *ArenaState) Render(renderer *pixelgl.Window)
- func (s *ArenaState) RenderRoundItem(a ...interface{})
- func (s *ArenaState) Update(dt float64) bool
- func (s *ArenaState) WinRound(index int, round *ArenaRound)
- type AttackOptions
- type BarStats
- type BlockUntilEvent
- type BrowseListState
- func (s *BrowseListState) Enter()
- func (s *BrowseListState) Exit()
- func (s *BrowseListState) HandleInput(win *pixelgl.Window)
- func (s *BrowseListState) Hide()
- func (s *BrowseListState) Render(renderer *pixelgl.Window)
- func (s *BrowseListState) SetArrowPosition()
- func (s *BrowseListState) Show()
- func (s *BrowseListState) Update(dt float64) bool
- type CEAttack
- func (c CEAttack) CountDown() float64
- func (c *CEAttack) CountDownSet(t float64)
- func (c *CEAttack) CounterTarget(target *combat.Actor)
- func (c *CEAttack) DoAttack()
- func (c *CEAttack) Execute(queue *EventQueue)
- func (c CEAttack) IsFinished() bool
- func (c CEAttack) Name() string
- func (c CEAttack) Owner() *combat.Actor
- func (c CEAttack) TimePoints(queue *EventQueue) float64
- func (c CEAttack) Update()
- type CECastSpell
- func (c *CECastSpell) CountDown() float64
- func (c *CECastSpell) CountDownSet(t float64)
- func (c *CECastSpell) DoCast()
- func (c *CECastSpell) DoFinish()
- func (c *CECastSpell) Execute(queue *EventQueue)
- func (c *CECastSpell) HideSpellNotice()
- func (c *CECastSpell) IsFinished() bool
- func (c *CECastSpell) Name() string
- func (c *CECastSpell) Owner() *combat.Actor
- func (c *CECastSpell) ShowSpellNotice()
- func (c CECastSpell) TimePoints(queue *EventQueue) float64
- func (c *CECastSpell) Update()
- type CEFlee
- func (c CEFlee) CountDown() float64
- func (c *CEFlee) CountDownSet(t float64)
- func (c *CEFlee) DoFleeSuccess()
- func (c *CEFlee) Execute(queue *EventQueue)
- func (c CEFlee) IsFinished() bool
- func (c CEFlee) Name() string
- func (c *CEFlee) OnFleeFail()
- func (c CEFlee) Owner() *combat.Actor
- func (c CEFlee) TimePoints(queue *EventQueue) float64
- func (c *CEFlee) Update()
- type CESlash
- func (c *CESlash) AttackTarget(target *combat.Actor)
- func (c *CESlash) CountDown() float64
- func (c *CESlash) CountDownSet(t float64)
- func (c *CESlash) CounterTarget(target *combat.Actor)
- func (c *CESlash) DoAttack()
- func (c *CESlash) Execute(queue *EventQueue)
- func (c *CESlash) IsFinished() bool
- func (c *CESlash) Name() string
- func (c *CESlash) OnFinish()
- func (c *CESlash) Owner() *combat.Actor
- func (c *CESlash) ShowNotice()
- func (c *CESlash) TimePoints(queue *EventQueue) float64
- func (c *CESlash) Update()
- type CESteal
- func (c *CESteal) CountDown() float64
- func (c *CESteal) CountDownSet(t float64)
- func (c *CESteal) DoSteal()
- func (c *CESteal) Execute(queue *EventQueue)
- func (c *CESteal) HideNotice()
- func (c *CESteal) IsFinished() bool
- func (c *CESteal) Name() string
- func (c *CESteal) OnFinish()
- func (c *CESteal) Owner() *combat.Actor
- func (c *CESteal) ShowNotice()
- func (c *CESteal) ShowResult()
- func (c *CESteal) StealFrom(target *combat.Actor) bool
- func (c *CESteal) TeleportIn()
- func (c *CESteal) TeleportOut()
- func (c *CESteal) TimePoints(queue *EventQueue) float64
- func (c *CESteal) Update()
- type CETurn
- func (c CETurn) CountDown() float64
- func (c *CETurn) CountDownSet(t float64)
- func (c *CETurn) Execute(queue *EventQueue)
- func (c CETurn) IsFinished() bool
- func (c CETurn) Name() string
- func (c CETurn) Owner() *combat.Actor
- func (c CETurn) TimePoints(queue *EventQueue) float64
- func (c *CETurn) Update()
- type CEUseItem
- func (c *CEUseItem) CountDown() float64
- func (c *CEUseItem) CountDownSet(t float64)
- func (c *CEUseItem) DoFinish()
- func (c *CEUseItem) DoUseItem()
- func (c *CEUseItem) Execute(queue *EventQueue)
- func (c *CEUseItem) IsFinished() bool
- func (c *CEUseItem) Name() string
- func (c *CEUseItem) Owner() *combat.Actor
- func (c *CEUseItem) ShowItemNotice()
- func (c CEUseItem) TimePoints(queue *EventQueue) float64
- func (c *CEUseItem) Update()
- type CSEnemyDie
- type CSHurt
- type CSMove
- type CSMoveParams
- type CSRunAnim
- type CSStandBy
- type Character
- type CharacterDefinition
- type CharacterStateBase
- type CombatCharacters
- type CombatChoiceParams
- type CombatChoiceState
- func (c *CombatChoiceState) CreateActionDialog(choices interface{})
- func (c *CombatChoiceState) CreateActionTargeter(def world.SpecialItem, browseState *BrowseListState, ...) *CombatTargetState
- func (c *CombatChoiceState) CreateItemTargeter(def world.Item, browseState *BrowseListState) *CombatTargetState
- func (c *CombatChoiceState) Enter()
- func (c *CombatChoiceState) Exit()
- func (c CombatChoiceState) HandleInput(win *pixelgl.Window)
- func (c *CombatChoiceState) Hide()
- func (c *CombatChoiceState) OnItemAction()
- func (c *CombatChoiceState) OnMagicAction()
- func (c *CombatChoiceState) OnSelect(index int, str interface{})
- func (c *CombatChoiceState) OnSpecialAction()
- func (c CombatChoiceState) Render(renderer *pixelgl.Window)
- func (c *CombatChoiceState) SetArrowPosition()
- func (c *CombatChoiceState) Show()
- func (c *CombatChoiceState) TakeAction(id string, targets []*combat.Actor)
- func (c *CombatChoiceState) Update(dt float64) bool
- type CombatData
- type CombatDef
- type CombatEvent
- func CECastSpellCreate(scene *CombatState, owner *combat.Actor, targets []*combat.Actor, ...) CombatEvent
- func CESlashCreate(scene *CombatState, owner *combat.Actor, targets []*combat.Actor, ...) CombatEvent
- func CEStealCreate(scene *CombatState, owner *combat.Actor, targets []*combat.Actor, ...) CombatEvent
- type CombatSelectorFunc
- type CombatState
- func (c *CombatState) AddEffect(fx EffectState)
- func (c *CombatState) AddTextEffect(actor *combat.Actor, txt string, priority int)
- func (c *CombatState) AddTurns(actorList []*combat.Actor)
- func (c *CombatState) ApplyCounter(target, owner *combat.Actor)
- func (c *CombatState) ApplyDamage(target *combat.Actor, damage float64, isCritical bool)
- func (c *CombatState) ApplyDodge(target *combat.Actor)
- func (c *CombatState) ApplyMiss(target *combat.Actor)
- func (c *CombatState) BuildBars(actor *combat.Actor)
- func (c *CombatState) CalcCombatData() CombatData
- func (c *CombatState) CreateCombatCharacters(key string)
- func (c *CombatState) DrawHP(renderer pixel.Target, x, y float64, actor *combat.Actor)
- func (c *CombatState) DrawHpBarAtFeet(renderer pixel.Target, x, y float64, actor *combat.Actor)
- func (c *CombatState) DrawMP(renderer pixel.Target, x, y float64, actor *combat.Actor)
- func (c CombatState) EnemyWins() bool
- func (c *CombatState) Enter()
- func (c *CombatState) Exit()
- func (c CombatState) GetAlivePartyActors() []*combat.Actor
- func (c *CombatState) GetTarget(owner *combat.Actor) *combat.Actor
- func (c *CombatState) HandleDeath()
- func (c *CombatState) HandleEnemyDeath()
- func (c *CombatState) HandleInput(win *pixelgl.Window)
- func (c *CombatState) HandlePartyDeath()
- func (c CombatState) HasLiveActors(actorList []*combat.Actor) bool
- func (c *CombatState) HasPartyFled() bool
- func (c *CombatState) HideNotice()
- func (c *CombatState) HideTip()
- func (c CombatState) IsEnemyDefeated() bool
- func (c CombatState) IsPartyDefeated() bool
- func (c *CombatState) IsPartyMember(owner *combat.Actor) bool
- func (c *CombatState) OnDead(actor *combat.Actor)
- func (c *CombatState) OnFlee()
- func (c *CombatState) OnLose()
- func (c *CombatState) OnPartyMemberSelect(index int, str interface{})
- func (c *CombatState) OnWin()
- func (c CombatState) PartyWins() bool
- func (c CombatState) Render(renderer *pixelgl.Window)
- func (c *CombatState) RenderPartyNames(args ...interface{})
- func (c *CombatState) RenderPartyStats(args ...interface{})
- func (c *CombatState) ShowNotice(txt string)
- func (c *CombatState) ShowTip(txt string)
- func (c *CombatState) Update(dt float64) bool
- type CombatTargetState
- func (t *CombatTargetState) Down()
- func (t *CombatTargetState) Enter()
- func (t *CombatTargetState) Exit()
- func (t CombatTargetState) GetActorList(actor *combat.Actor) []*combat.Actor
- func (t CombatTargetState) GetIndex(listI []*combat.Actor, item *combat.Actor) int
- func (t *CombatTargetState) HandleInput(win *pixelgl.Window)
- func (t *CombatTargetState) Left()
- func (t *CombatTargetState) Render(renderer *pixelgl.Window)
- func (t *CombatTargetState) Right()
- func (t *CombatTargetState) Up()
- func (t *CombatTargetState) Update(dt float64) bool
- type CombatTextFX
- type Direction
- type EffectState
- type Entity
- func (e *Entity) AddChild(id string, entity *Entity)
- func (e *Entity) GetSelectPosition() pixel.Vec
- func (e *Entity) GetTargetPosition() pixel.Vec
- func (e Entity) GetTilePositionOnMap(gMap *GameMap) (vec pixel.Vec)
- func (e *Entity) RemoveChild(id string)
- func (e *Entity) Render(gMap *GameMap, renderer pixel.Target, pos pixel.Vec)
- func (e *Entity) SetFrame(frame int)
- func (e *Entity) SetTilePos(x, y float64)
- func (e *Entity) TeleportAndDraw(gMap *GameMap, canvas *pixelgl.Canvas)
- type EntityDefinition
- type EquipMenuState
- func (e *EquipMenuState) DrawStat(renderer pixel.Target, x, y float64, label, statId string, diff float64)
- func (e *EquipMenuState) Enter(data ...interface{})
- func (e EquipMenuState) Exit()
- func (e *EquipMenuState) FocusSlotMenu()
- func (e *EquipMenuState) GetSelectedItem() int
- func (e EquipMenuState) GetSelectedSlot() string
- func (e EquipMenuState) IsFinished() bool
- func (e *EquipMenuState) OnDoEquip(index int, itemIdxI interface{})
- func (e *EquipMenuState) OnEquipMenuChanged()
- func (e *EquipMenuState) OnSelectMenu(i int, wItemTypeI interface{})
- func (e *EquipMenuState) RefreshFilteredMenus()
- func (e EquipMenuState) Render(renderer *pixelgl.Window)
- func (e *EquipMenuState) Update(dt float64)
- type EventQueue
- func (q EventQueue) ActorHasEvent(actor *combat.Actor) bool
- func (q *EventQueue) Add(eventI CombatEvent, timePoints float64)
- func (q *EventQueue) Clear()
- func (q EventQueue) IsEmpty() bool
- func (q EventQueue) Print()
- func (q *EventQueue) RemoveEventsOwnedBy(actor *combat.Actor)
- func (q *EventQueue) Render(win *pixelgl.Window)
- func (q EventQueue) SpeedToTimePoints(speed float64) float64
- func (q *EventQueue) Update()
- type ExploreState
- func (es *ExploreState) AddNPC(NPC *Character)
- func (es ExploreState) Enter()
- func (es ExploreState) Exit()
- func (es ExploreState) HandleInput(win *pixelgl.Window)
- func (es *ExploreState) HideHero()
- func (es ExploreState) Render(win *pixelgl.Window)
- func (es *ExploreState) SetFollowCam(shouldFollow bool, char *Character)
- func (es *ExploreState) SetManualCam(tileX, tileY float64)
- func (es *ExploreState) ShowHero(tileX, tileY float64)
- func (es *ExploreState) Update(dt float64) bool
- func (es *ExploreState) UpdateCamera(gMap *GameMap)
- type FilterList
- type FollowPathState
- type FormulaT
- type FrontMenuState
- func (fm FrontMenuState) CreatePartySummaries() []combat.ActorSummary
- func (fm FrontMenuState) Enter(data ...interface{})
- func (fm FrontMenuState) Exit()
- func (fm FrontMenuState) IsFinished() bool
- func (fm *FrontMenuState) OnMenuClick(index int, str interface{})
- func (fm *FrontMenuState) OnPartyMemberChosen(actorIndex int, actorSummaryI interface{})
- func (fm FrontMenuState) Render(renderer *pixelgl.Window)
- func (fm *FrontMenuState) Update(dt float64)
- type GameMap
- func (m *GameMap) AddNPC(npc *Character)
- func (m *GameMap) AddTrigger(id string, tileX, tileY float64)
- func (m *GameMap) ClearAllEntities()
- func (m GameMap) DrawAfter(target pixel.Target, callback func(canvas *pixelgl.Canvas, layer int)) error
- func (m GameMap) GetEntityAtPos(x, y float64) *Entity
- func (m *GameMap) GetNPC(tileX, tileY float64) *Character
- func (m GameMap) GetTileIndex(tileX, tileY float64) (x, y float64)
- func (m GameMap) GetTilePositionAtFeet(x, y, charW, charH float64) pixel.Vec
- func (m GameMap) GetTrigger(tileX, tileY float64) Trigger
- func (m *GameMap) GoToTile(x, y float64)
- func (m *GameMap) Goto(x, y float64)
- func (m GameMap) IsBlockingTile(tileX, tileY int) bool
- func (m *GameMap) RemoveNPC(tileX, tileY float64) bool
- func (m *GameMap) RemoveTrigger(tileX, tileY float64)
- func (m *GameMap) SetHiddenTileVisible(tileX, tileY int)
- func (m *GameMap) SetTrigger(tileX, tileY float64, t Trigger)
- func (m *GameMap) WriteTile(tileX, tileY float64, collision bool)
- type GameOverState
- type HitResult
- type InGameMenuState
- type ItemsMenuState
- func (im ItemsMenuState) Enter(data ...interface{})
- func (im ItemsMenuState) Exit()
- func (im *ItemsMenuState) FocusOnCategoryMenu()
- func (im ItemsMenuState) IsFinished() bool
- func (im *ItemsMenuState) OnCategorySelect(index int, value interface{})
- func (im ItemsMenuState) Render(win *pixelgl.Window)
- func (im *ItemsMenuState) Update(dt float64)
- type JumpingNumbersFX
- type LootSummaryState
- func (s *LootSummaryState) Enter()
- func (s *LootSummaryState) Exit()
- func (s *LootSummaryState) HandleInput(win *pixelgl.Window)
- func (s *LootSummaryState) Render(renderer *pixelgl.Window)
- func (s *LootSummaryState) RenderItem(a ...interface{})
- func (s *LootSummaryState) SkipCountingGold()
- func (s *LootSummaryState) Update(dt float64) bool
- type MapAction
- type MapInfo
- type MoveState
- type NPCStrollWaitState
- type NPCWaitState
- type NonBlockEvent
- type NonBlockingTimer
- type PanelTitle
- type SBEvent
- type ScreenState
- type SleepState
- type StatusMenuState
- func (s StatusMenuState) DrawStat(renderer pixel.Target, x, y float64, label string, value float64)
- func (s *StatusMenuState) Enter(data ...interface{})
- func (s StatusMenuState) Exit()
- func (s StatusMenuState) IsFinished() bool
- func (s StatusMenuState) Render(renderer *pixelgl.Window)
- func (s StatusMenuState) Update(dt float64)
- type Storyboard
- func (s Storyboard) CleanUp()
- func (s Storyboard) Enter()
- func (s Storyboard) Exit()
- func (s Storyboard) HandleInput(win *pixelgl.Window)
- func (s *Storyboard) PushState(identifier string, state gui.StackInterface)
- func (s *Storyboard) RemoveState(identifier string)
- func (s Storyboard) Render(win *pixelgl.Window)
- func (s *Storyboard) Update(dt float64) bool
- type TimedTextboxEvent
- type Trigger
- type TriggerParam
- type TriggerType
- type TweenEvent
- type WaitEvent
- type WaitState
- type XPSummaryState
- func (s *XPSummaryState) ApplyXPToParty(xp float64)
- func (s XPSummaryState) ArePopUpsRemaining() bool
- func (s *XPSummaryState) CloseNextPopUp()
- func (s *XPSummaryState) Enter()
- func (s *XPSummaryState) Exit()
- func (s *XPSummaryState) GotoLootSummary()
- func (s *XPSummaryState) HandleInput(win *pixelgl.Window)
- func (s *XPSummaryState) Render(renderer *pixelgl.Window)
- func (s *XPSummaryState) SkipCountingXP()
- func (s *XPSummaryState) UnlockPopUps(summary *combat.ActorXPSummary, levelUpActions map[string][]string)
- func (s *XPSummaryState) Update(dt float64) bool
Constants ¶
This section is empty.
Variables ¶
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, }, }
var CharacterFacingDirection = [4]string{"up", "right", "down", "left"}
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, }
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, }
var CombatSelector = CombatSelectorFunc{ RandomAlivePlayer: RandomAlivePlayer, WeakestEnemy: WeakestEnemy, SideEnemy: SideEnemy, SelectAll: SelectAll, }
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]) }, }
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
var Formula = FormulaT{ MeleeAttack: meleeAttack, BaseAttack: baseAttack, CalcDamage: calcDamage, IsHit: isHit, IsDodged: isDodged, IsCountered: isCountered, CanFlee: canFlee, Steal: Steal, }
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"), }
var LIST = make(map[string]func(gMap *GameMap, a ...interface{}) func(b ...interface{}))
var MapsDB map[string]func(gStack *gui.StateStack) MapInfo
Functions ¶
func ActionTeleport ¶
ActionTeleport : *GameMap, Direction => *Entity => ()
func AddAnimEffect ¶
func AddAnimEffect(state *CombatState, entity *Entity, fxEntityDef EntityDefinition, spf float64)
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 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 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 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 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 WeakestEnemy ¶
func WeakestEnemy(state *CombatState) []*combat.Actor
Types ¶
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 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) CountDownSet ¶
func (*CEAttack) CounterTarget ¶
CounterTarget - Decide if the attack is countered.
func (*CEAttack) Execute ¶
func (c *CEAttack) Execute(queue *EventQueue)
func (CEAttack) IsFinished ¶
func (CEAttack) TimePoints ¶
func (c CEAttack) TimePoints(queue *EventQueue) float64
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) CountDownSet ¶
func (*CEFlee) DoFleeSuccess ¶
func (c *CEFlee) DoFleeSuccess()
func (*CEFlee) Execute ¶
func (c *CEFlee) Execute(queue *EventQueue)
func (CEFlee) IsFinished ¶
func (*CEFlee) OnFleeFail ¶
func (c *CEFlee) OnFleeFail()
func (CEFlee) TimePoints ¶
func (c CEFlee) TimePoints(queue *EventQueue) float64
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 (*CESlash) CountDownSet ¶
func (*CESlash) CounterTarget ¶
func (*CESlash) Execute ¶
func (c *CESlash) Execute(queue *EventQueue)
func (*CESlash) IsFinished ¶
func (*CESlash) ShowNotice ¶
func (c *CESlash) ShowNotice()
func (*CESlash) TimePoints ¶
func (c *CESlash) TimePoints(queue *EventQueue) float64
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) CountDownSet ¶
func (*CESteal) Execute ¶
func (c *CESteal) Execute(queue *EventQueue)
func (*CESteal) HideNotice ¶
func (c *CESteal) HideNotice()
func (*CESteal) IsFinished ¶
func (*CESteal) ShowNotice ¶
func (c *CESteal) ShowNotice()
func (*CESteal) ShowResult ¶
func (c *CESteal) ShowResult()
func (*CESteal) TeleportIn ¶
func (c *CESteal) TeleportIn()
func (*CESteal) TeleportOut ¶
func (c *CESteal) TeleportOut()
func (*CESteal) TimePoints ¶
func (c *CESteal) TimePoints(queue *EventQueue) float64
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) CountDownSet ¶
func (*CETurn) Execute ¶
func (c *CETurn) Execute(queue *EventQueue)
func (CETurn) IsFinished ¶
func (CETurn) TimePoints ¶
func (c CETurn) TimePoints(queue *EventQueue) float64
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 (*CEUseItem) CountDownSet ¶
func (*CEUseItem) Execute ¶
func (c *CEUseItem) Execute(queue *EventQueue)
func (*CEUseItem) IsFinished ¶
func (*CEUseItem) ShowItemNotice ¶
func (c *CEUseItem) ShowItemNotice()
func (CEUseItem) TimePoints ¶
func (c CEUseItem) TimePoints(queue *EventQueue) float64
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) IsFinished ¶
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) IsFinished ¶
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) IsFinished ¶
type CSStandBy ¶
type CSStandBy struct { Name string Character *Character CombatState *CombatState Entity *Entity Anim animation.Animation AnimId string }
func (CSStandBy) IsFinished ¶
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 (*Character) FollowPath ¶
func (*Character) GetCombatAnim ¶
func (Character) GetFacedTileCoords ¶
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 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 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) DrawHpBarAtFeet ¶
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) 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 ¶
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 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) GetSelectPosition ¶
GetSelectPosition gets Head position minus offset
func (*Entity) GetTargetPosition ¶
func (Entity) GetTilePositionOnMap ¶
func (*Entity) RemoveChild ¶
func (*Entity) SetTilePos ¶
type EntityDefinition ¶
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) 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) 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 (*GameMap) AddTrigger ¶
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 (GameMap) GetTileIndex ¶
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 (GameMap) GetTrigger ¶
func (GameMap) IsBlockingTile ¶
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) RemoveTrigger ¶
RemoveTrigger accept actual Tiled App coordinates e.g. 35, 22
func (*GameMap) SetHiddenTileVisible ¶
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 ¶
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
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 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) IsFinished ¶
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 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) 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) 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 ¶
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 TriggerType ¶
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 WaitEventCreate ¶
func (WaitEvent) IsBlocking ¶
func (WaitEvent) IsFinished ¶
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) IsFinished ¶
The StateMachine requires each state to have four functions: Enter, Exit, Render and Update
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
Source Files ¶
- actions.go
- ce_attack.go
- ce_cast_spell.go
- ce_combat_event.go
- ce_event_queue.go
- ce_flee.go
- ce_scene.go
- ce_special_slash.go
- ce_special_steal.go
- ce_turn.go
- ce_use_item.go
- character.go
- character_definitions.go
- characters.go
- combat_action.go
- combat_formula.go
- combat_selector.go
- entity.go
- entity_definitions.go
- explore_state.go
- fx_anim_entity.go
- fx_combat_text.go
- fx_effect_state_interface.go
- fx_jumping_numbers.go
- game_map.go
- intro_scene.go
- map_actions.go
- map_arena.go
- map_jail.go
- map_sewer.go
- map_town.go
- maps_db.go
- screen_state.go
- state_arena.go
- state_arena_complete.go
- state_browse_list.go
- state_combat_choice.go
- state_combat_enemy_die.go
- state_combat_hurt.go
- state_combat_init.go
- state_combat_layout.go
- state_combat_move.go
- state_combat_run_anim.go
- state_combat_standby.go
- state_combat_target.go
- state_follow_path.go
- state_game_over.go
- state_hero_move.go
- state_hero_wait.go
- state_menu_equip.go
- state_menu_front.go
- state_menu_in-game.go
- state_menu_items.go
- state_menu_status.go
- state_npc_sleep.go
- state_npc_stroll_wait.go
- state_npc_wait.go
- state_summary_loot.go
- state_summary_xp.go
- storyboard.go
- storyboard_block_until_event.go
- storyboard_events.go
- storyboard_non_blocking_event.go
- storyboard_non_blocking_timer.go
- storyboard_timed_textbox_event.go
- storyboard_tween_event.go
- storyboard_wait_event.go
- trigger.go