Documentation ¶
Overview ¶
Package entities provides common entity constructor functions
Index ¶
- func Arrows(mvr *Entity)
- func CenterScreenOn(mvr *Entity)
- func Limit(mvr *Entity, rect floatgeom.Rect2)
- func TopDown(mvr *Entity, up, down, left, right key.Code)
- func WASD(mvr *Entity)
- type Entity
- func (e Entity) Bottom() float64
- func (e Entity) CID() event.CallerID
- func (e *Entity) Destroy()
- func (e Entity) H() float64
- func (e *Entity) HitLabel(label collision.Label) *collision.Space
- func (e Entity) Left() float64
- func (e *Entity) Metadata(k string) (v string, ok bool)
- func (e Entity) Right() float64
- func (e *Entity) SetMetadata(k, v string)
- func (e *Entity) SetPos(p floatgeom.Point2)
- func (e *Entity) SetX(x float64)
- func (e *Entity) SetY(y float64)
- func (e *Entity) Shift(delta floatgeom.Point2)
- func (e *Entity) ShiftDelta()
- func (e *Entity) ShiftPos(x, y float64)
- func (e *Entity) ShiftX(x float64)
- func (e *Entity) ShiftY(y float64)
- func (e Entity) Top() float64
- func (e Entity) W() float64
- func (e Entity) X() float64
- func (e Entity) Y() float64
- type Generator
- type Option
- func And(opts ...Option) Option
- func WithChild(opts ...Option) Option
- func WithChildren(v [][]Option) Option
- func WithColor(v color.Color) Option
- func WithDimensions(v floatgeom.Point2) Option
- func WithDrawLayers(v []int) Option
- func WithExplicitChild(e *Entity) Option
- func WithLabel(v collision.Label) Option
- func WithMod(v mod.Mod) Option
- func WithOffset(p floatgeom.Point2) Option
- func WithParent(v event.Caller) Option
- func WithPosition(v floatgeom.Point2) Option
- func WithRect(v floatgeom.Rect2) Option
- func WithRenderable(v render.Renderable) Option
- func WithSpeed(v floatgeom.Point2) Option
- func WithUseMouseTree(v bool) Option
- func WithWithoutCollision(v bool) Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Arrows ¶
func Arrows(mvr *Entity)
Arrows moves the given mover based on its speed as the arrow keys are pressed
func CenterScreenOn ¶
func CenterScreenOn(mvr *Entity)
CenterScreenOn will cause the screen to center on the given mover, obeying viewport limits if they have been set previously
Types ¶
type Entity ¶
type Entity struct { event.CallerID Rect floatgeom.Rect2 Speed floatgeom.Point2 Delta floatgeom.Point2 Renderable render.Renderable collision.Phase Space *collision.Space Tree *collision.Tree Children []*Entity // contains filtered or unexported fields }
func (*Entity) Metadata ¶
Metadata accesses the value, and whether it existed, for a given metadata key
func (*Entity) SetMetadata ¶
SetMetadata sets the metadata for some key to some value. Empty value strings will not be stored.
func (*Entity) ShiftDelta ¶
func (e *Entity) ShiftDelta()
type Generator ¶
type Generator struct { Position floatgeom.Point2 Dimensions floatgeom.Point2 Speed floatgeom.Point2 Parent event.Caller Color color.Color Renderable render.Renderable Mod mod.Mod Label collision.Label DrawLayers []int UseMouseTree bool WithoutCollision bool Children [][]Option ExplicitChildren []*Entity }
type Option ¶
func WithChildren ¶
func WithDimensions ¶
func WithDrawLayers ¶
func WithExplicitChild ¶ added in v4.1.0
func WithOffset ¶
func WithParent ¶
func WithPosition ¶
func WithRenderable ¶
func WithRenderable(v render.Renderable) Option
func WithUseMouseTree ¶
func WithWithoutCollision ¶
Click to show internal directories.
Click to hide internal directories.