Documentation
¶
Overview ¶
Package motion moves the world's entities: every step it steers them, runs the rules of a Moving over them, moves each by its velocity, never further than Position.MaxStep, and deals with those gone past an open edge. A world without it keeps its entities where they stand.
Plugin ¶
Plugin is made over the world (NewPlugin) before what steers or pushes the entities, which takes it as it is made (collision, bullet, driving, navigation, gravity; a board's units, board.Plugin.WithMotion); its Plugin.RunPlan is called right after the world's. Its sub-package steering is how an entity is steered: a heading and a speed reached gradually. Steering and movement go slowing with a sector's distance in levels from the finest any observer sees (lod.Slowing): full pace where the viewer looks most closely.
Units and Drift ¶
UnitTemplate is the template of the kinds that move, under the world's entity template: the plugins ask of it what every unit carries, motion a steering.Course. Drift is a velocity an entity is carried at beside its own, which gravity writes.
Leaving ¶
An entity wholly past an open edge carries Outside; the rules of a Leaving hear of it every tick, and with none it is despawned. A plugin moving entities itself marks one it put out with Write.Leave.
Vocabulary ¶
Moments, for a role's rules: Moving (every entity before it moves; its words Still, Braking), Leaving (every tick an entity is past an open edge). Knobs, for an effect's Alter: steering.Steering. Commands, an entity's own: steering.Away, steering.Toward, steering.Turn.
Index ¶
- Variables
- func Braking() cond.Word[Moving]
- func Still() cond.Word[Moving]
- type Drift
- type Leaving
- type Moving
- type Outside
- type Plugin
- func (p *Plugin) DefaultBindings() []control.Binding
- func (p *Plugin) EventHandler() control.EventHandler
- func (p *Plugin) Install(ctx plugin.Installer) error
- func (p *Plugin) KindTemplates(r *kind.Roster)
- func (p *Plugin) Name() string
- func (p *Plugin) Queues() []command.CommandQueue
- func (p *Plugin) RunPlan(ctx goke.RunCtx, d time.Duration)
- func (p *Plugin) Serializable() plugin.Serializable
- func (p *Plugin) Write() *Write
- type Write
Constants ¶
This section is empty.
Variables ¶
var UnitTemplate = kind.NewTemplate("unit", world.EntityTemplate)
UnitTemplate is the template of the kinds that move, steered, a world's entity besides.
Functions ¶
Types ¶
type Drift ¶
Drift is the velocity an entity is carried at beyond its walk (falling, thrown), as package entity has it.
type Leaving ¶
Leaving is the moment of an entity carrying Outside, every tick it does. With no rule of it motion despawns the leaver.
type Moving ¶
Moving is the moment of every entity in the velocity pass, every step: a rule of it scales Base.Vel.Value to slow or stop the entity. Course is the steering's, nil for an entity with none.
type Outside ¶
type Outside struct{}
Outside marks an entity wholly past an open edge, taken off once it is back inside.
type Plugin ¶
Plugin moves the world's entities: it steers them, moves each by its velocity and deals with those gone past an open edge.
func (*Plugin) DefaultBindings ¶
DefaultBindings is nil: an entity steers itself in its rules.
func (*Plugin) EventHandler ¶
func (p *Plugin) EventHandler() control.EventHandler
EventHandler is nil: motion reads no input.
func (*Plugin) KindTemplates ¶
KindTemplates is what motion asks of the kinds a game defines: every unit a course its steering keeps.
func (*Plugin) Queues ¶
func (p *Plugin) Queues() []command.CommandQueue
Queues are the queues of the steering's commands, an entity's own (steering.Away, Toward, Turn).
func (*Plugin) RunPlan ¶
RunPlan steers and moves the entities and deals with the leavers; call it right after the world's RunPlan.
func (*Plugin) Serializable ¶
func (p *Plugin) Serializable() plugin.Serializable
Serializable is nil: motion keeps no state beside its components.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
internal
|
|
|
motiontest
Package motiontest is what motion's tests share: an installer and a world with motion, stepped as a game steps it.
|
Package motiontest is what motion's tests share: an installer and a world with motion, stepped as a game steps it. |
|
Package steering turns what an entity wants into motion, gradually.
|
Package steering turns what an entity wants into motion, gradually. |