domain

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SpriteUILayerUI = 200 + iota*10
	SpriteUILayerBackground
	SpriteUILayerText
	SpriteUILayerButtons
	SpriteUILayerTop
)
View Source
const (
	CreditsPassage = "credits"
)

Variables

View Source
var ButtonClickedEvent = events.NewEventType[ButtonClicked]()
View Source
var CharacterSpeedChangedEvent = events.NewEventType[CharacterSpeedChanged]()
View Source
var InventoryUpdatedEvent = events.NewEventType[InventoryUpdated]()
View Source
var ItemLostEvent = events.NewEventType[ItemLost]()
View Source
var ItemReceivedEvent = events.NewEventType[ItemReceived]()
View Source
var JustCollidedEvent = events.NewEventType[JustCollided]()
View Source
var JustOutOfCollisionEvent = events.NewEventType[JustOutOfCollision]()
View Source
var MoneyReceivedEvent = events.NewEventType[MoneyReceived]()
View Source
var MoneySpentEvent = events.NewEventType[MoneySpent]()
View Source
var MusicChangedEvent = events.NewEventType[MusicChanged]()
View Source
var StoryFactSetEvent = events.NewEventType[StoryFactSet]()

Functions

This section is empty.

Types

type Assets

type Assets struct {
	Story     RawStory
	Levels    map[string]Level
	Character Character
	Sounds    Sounds
	Music     map[string][]byte

	NightOverlay *ebiten.Image

	TitleBackground *ebiten.Image
}

type ButtonClicked

type ButtonClicked struct{}

type Character

type Character struct {
	Frames   []*ebiten.Image
	Collider engine.Rect
}

type CharacterPosition

type CharacterPosition struct {
	LocalPosition math.Vec2
	FlipY         bool
}

type CharacterSpeedChanged

type CharacterSpeedChanged struct {
	SpeedChange float64
}

type ColliderLayer

type ColliderLayer int
const (
	CollisionLayerNone      ColliderLayer = iota
	CollisionLayerButton    ColliderLayer = iota
	CollisionLayerCharacter ColliderLayer = iota
	CollisionLayerPOI       ColliderLayer = iota
)

type Condition

type Condition struct {
	Positive bool
	Type     ConditionType
	Value    string
}

type ConditionType

type ConditionType string
const (
	ConditionTypeHasItem  ConditionType = "hasItem"
	ConditionTypeFact     ConditionType = "fact"
	ConditionTypeHasMoney ConditionType = "hasMoney"
)

type Direction

type Direction string
var (
	EdgeLeft  Direction = "left"
	EdgeRight Direction = "right"
)

type Entrypoint

type Entrypoint struct {
	Index             int
	CharacterPosition CharacterPosition
}

type InventoryItem

type InventoryItem struct {
	Name  string
	Count int
}

type InventoryUpdated

type InventoryUpdated struct {
	Money int
	Items []InventoryItem
}

type Item

type Item struct {
	Name  string
	Count int
}

type ItemLost

type ItemLost struct {
	Item InventoryItem
}

type ItemReceived

type ItemReceived struct {
	Item InventoryItem
}

type JustCollided

type JustCollided struct {
	Entry      *donburi.Entry
	Layer      ColliderLayer
	Other      *donburi.Entry
	OtherLayer ColliderLayer
}

type JustOutOfCollision

type JustOutOfCollision struct {
	Entry      *donburi.Entry
	Layer      ColliderLayer
	Other      *donburi.Entry
	OtherLayer ColliderLayer
}

type LayerID

type LayerID int
const (
	SpriteLayerBackground LayerID = 100 + iota*10
	SpriteLayerObjects
	SpriteLayerCharacter
	SpriteLayerForeground
	SpriteLayerIndicator
)

type Level

type Level struct {
	Name        string
	Background  func() *ebiten.Image
	POIs        []POI
	Objects     []Object
	Entrypoints []Entrypoint
	CameraZoom  float64
	Character   LevelCharacter
	Limits      *engine.FloatRange
	Fadepoint   *math.Vec2
	Outdoor     bool
}

type LevelCharacter

type LevelCharacter struct {
	PosY  float64
	Scale float64
}
type Link struct {
	Text       string
	Target     *Passage
	Level      *TargetLevel
	Conditions []Condition
	Visited    bool
	Tags       []string
	// contains filtered or unexported fields
}

func (*Link) AllVisited

func (l *Link) AllVisited() bool

func (*Link) HasTag

func (l *Link) HasTag(tag string) bool

func (*Link) IsExit

func (l *Link) IsExit() bool

func (*Link) Visit

func (l *Link) Visit()

type Macro

type Macro struct {
	Type  MacroType
	Value string
}

type MacroType

type MacroType string
const (
	MacroTypeAddItem              MacroType = "addItem"
	MacroTypeTakeItem             MacroType = "takeItem"
	MacroTypeSetFact              MacroType = "setFact"
	MacroTypeAddMoney             MacroType = "addMoney"
	MacroTypeTakeMoney            MacroType = "takeMoney"
	MacroTypePlayMusic            MacroType = "playMusic"
	MacroTypeChangeCharacterSpeed MacroType = "changeCharacterSpeed"
)

type MoneyReceived

type MoneyReceived struct {
	Amount int
}

type MoneySpent

type MoneySpent struct {
	Amount int
}

type MusicChanged

type MusicChanged struct {
	Track string
}

type Object

type Object struct {
	ID       int
	Image    *ebiten.Image
	Position math.Vec2
	Scale    math.Vec2
	Layer    LayerID
}

type POI

type POI struct {
	Object       Object
	ID           string
	TriggerRect  engine.Rect
	Passage      string
	Level        *TargetLevel
	EdgeTrigger  *Direction
	TouchTrigger bool
	ParentObject *Object
}

type Paragraph

type Paragraph struct {
	Text           string
	Align          ParagraphAlign
	Type           ParagraphType
	Conditions     []Condition
	Delay          time.Duration
	Effect         ParagraphEffect
	EffectDuration time.Duration
}

type ParagraphAlign

type ParagraphAlign int
const (
	ParagraphAlignLeft ParagraphAlign = iota
	ParagraphAlignCenter
)

type ParagraphEffect

type ParagraphEffect int
const (
	ParagraphEffectDefault ParagraphEffect = iota
	ParagraphEffectTyping
	ParagraphEffectFadeIn
	ParagraphEffectNone
)

type ParagraphType

type ParagraphType int
const (
	ParagraphTypeStandard ParagraphType = iota
	ParagraphTypeHeader
	ParagraphTypeHint
	ParagraphTypeFear
	ParagraphTypeReceived
	ParagraphTypeLost
	ParagraphTypeRead
)

type Passage

type Passage struct {
	Title      string
	Paragraphs []Paragraph
	Conditions []Condition
	Macros     []Macro
	AllLinks   []*Link

	IsOneTime bool
	Visited   bool
	// contains filtered or unexported fields
}

func (*Passage) AvailableParagraphs

func (p *Passage) AvailableParagraphs() []Paragraph

func (*Passage) ConditionsMet

func (p *Passage) ConditionsMet() bool

func (*Passage) Content

func (p *Passage) Content() string
func (p *Passage) Links() []*Link

func (*Passage) Visit

func (p *Passage) Visit()
type RawLink struct {
	Text       string
	Target     string
	Level      *TargetLevel
	Conditions []Condition
	Tags       []string
}

type RawPassage

type RawPassage struct {
	Title      string
	Tags       []string
	Paragraphs []Paragraph
	Conditions []Condition
	Macros     []Macro
	Links      []RawLink
}

type RawStory

type RawStory struct {
	Title      string
	Passages   []RawPassage
	StartLevel TargetLevel
}

type Sounds

type Sounds struct {
	Click1 []byte
}

type Story

type Story struct {
	Title      string
	Passages   map[string]*Passage
	StartLevel TargetLevel

	Money int
	Items []Item
	Facts map[string]bool
	// contains filtered or unexported fields
}

func NewStory

func NewStory(w donburi.World, rawStory RawStory) *Story

func (*Story) AddItem

func (s *Story) AddItem(item string)

func (*Story) AddMoney

func (s *Story) AddMoney(amount int)

func (*Story) Fact

func (s *Story) Fact(fact string) bool

func (*Story) PassageByTitle

func (s *Story) PassageByTitle(title string) *Passage

func (*Story) PassageForLevel

func (s *Story) PassageForLevel(level TargetLevel) (*Passage, bool)

func (*Story) SetFact

func (s *Story) SetFact(fact string)

func (*Story) SetFactTo

func (s *Story) SetFactTo(fact string, value bool)

SetFactTo removes a fact from the story Use only for debugging purposes.

func (*Story) TakeItem

func (s *Story) TakeItem(item string)

func (*Story) TestCondition

func (s *Story) TestCondition(c Condition) bool

type StoryFactSet

type StoryFactSet struct {
	Fact string
}

type TargetLevel

type TargetLevel struct {
	Name              string
	Entrypoint        *int
	CharacterPosition *CharacterPosition
}

Jump to

Keyboard shortcuts

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