Documentation ¶
Index ¶
- type Accel
- type Action
- type ActionRef
- type Bullet
- type BulletML
- type BulletMLType
- type BulletRef
- type BulletRunner
- type ChangeDirection
- type ChangeSpeed
- type Direction
- type DirectionType
- type Fire
- type FireContext
- type FireRef
- type Horizontal
- type HorizontalType
- type NewRunnerOptions
- type Param
- type Repeat
- type Runner
- type Speed
- type SpeedType
- type Term
- type Times
- type Vanish
- type Vertical
- type VerticalType
- type Wait
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Action ¶
type Action struct { XMLName xml.Name `xml:"action"` Label string `xml:"label,attr,omitempty"` Commands []any `xml:",any"` Comment string `xml:",comment"` // contains filtered or unexported fields }
func (*Action) UnmarshalXML ¶
type Bullet ¶
type Bullet struct { XMLName xml.Name `xml:"bullet"` Label string `xml:"label,attr,omitempty"` Direction *Direction `xml:"direction,omitempty"` Speed *Speed `xml:"speed,omitempty"` ActionOrRefs []any `xml:",any"` Comment string `xml:",comment"` // contains filtered or unexported fields }
func (*Bullet) UnmarshalXML ¶
type BulletML ¶
type BulletMLType ¶
type BulletMLType string
const ( BulletMLTypeNone BulletMLType = "none" BulletMLTypeVertical BulletMLType = "vertical" BulletMLTypeHorizontal BulletMLType = "horizontal" )
type BulletRunner ¶
type BulletRunner interface { Runner // Position returns the bullet position (x, y). Position() (float64, float64) // Vanished returns whether the bullet has vanished or not. Vanished() bool }
BulletRunner runs BulletML and updates the state of a bullet.
type ChangeDirection ¶
type ChangeSpeed ¶
type Direction ¶
type Direction struct { XMLName xml.Name `xml:"direction"` Type DirectionType `xml:"type,attr"` Expr string `xml:",chardata"` Comment string `xml:",comment"` // contains filtered or unexported fields }
type DirectionType ¶
type DirectionType string
const ( DirectionTypeAim DirectionType = "aim" DirectionTypeAbsolute DirectionType = "absolute" DirectionTypeRelative DirectionType = "relative" DirectionTypeSequence DirectionType = "sequence" )
type Fire ¶
type Fire struct { XMLName xml.Name `xml:"fire"` Label string `xml:"label,attr,omitempty"` Direction *Direction `xml:"direction,omitempty"` Speed *Speed `xml:"speed,omitempty"` Bullet *Bullet `xml:"bullet,omitempty"` BulletRef *BulletRef `xml:"bulletRef,omitempty"` Comment string `xml:",comment"` // contains filtered or unexported fields }
type FireContext ¶
type FireContext struct { // Fire field is the <fire> element which emits this event. Fire *Fire // Bullet field is the <bullet> element fired by this event. Bullet *Bullet }
FireContext contains context data of fire.
type Horizontal ¶
type Horizontal struct { XMLName xml.Name `xml:"horizontal"` Type HorizontalType `xml:"type,attr"` Expr string `xml:",chardata"` Comment string `xml:",comment"` // contains filtered or unexported fields }
type HorizontalType ¶
type HorizontalType string
const ( HorizontalTypeAbsolute HorizontalType = "absolute" HorizontalTypeRelative HorizontalType = "relative" HorizontalTypeSequence HorizontalType = "sequence" )
type NewRunnerOptions ¶
type NewRunnerOptions struct { // [Required] OnBulletFired is called when a bullet is fired. OnBulletFired func(BulletRunner, *FireContext) // [Required] CurrentShootPosition tells the runner where the shooter is. CurrentShootPosition func() (float64, float64) // [Required] CurrentTargetPosition tells the runner where the player is. CurrentTargetPosition func() (float64, float64) // DefaultBulletSpeed is the default value of bullet speed. 1.0 is used if not specified. DefaultBulletSpeed float64 // Random is used as a random generator in the runner. Random *rand.Rand // Rank is the value for $rank. Rank float64 }
NewRunnerOptions contains options for NewRunner function.
type Runner ¶
type Runner interface { // Update updates runner state. It should be called in every loop. Update() error }
Runner runs BulletML.
type Vertical ¶
type Vertical struct { XMLName xml.Name `xml:"vertical"` Type VerticalType `xml:"type,attr"` Expr string `xml:",chardata"` Comment string `xml:",comment"` // contains filtered or unexported fields }
type VerticalType ¶
type VerticalType string
const ( VerticalTypeAbsolute VerticalType = "absolute" VerticalTypeRelative VerticalType = "relative" VerticalTypeSequence VerticalType = "sequence" )
Click to show internal directories.
Click to hide internal directories.