mixins

package
v1.0.0-beta.10 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetStateOfEntity

func SetStateOfEntity(originator, predecessor *engine.Entity, of *engine.Entity, state bool) bool

SetStateOfEntity sets the state of an entity, if available. Returns whether the setting was successful.

func SetStateOfTarget

func SetStateOfTarget(w *engine.World, originator, predecessor *engine.Entity, targets TargetSelection, state bool)

SetStateOfTarget toggles the state of all entities of the given target name to the given state. Includes WarpZones too. Excludes the given entity (should be the caller).

Types

type Fadable

type Fadable struct {
	Settable
	World  *engine.World
	Entity *engine.Entity

	Alpha       float64
	Contents    level.Contents
	FadeFrames  int
	FadeDespawn bool

	AnimDir   int
	AnimFrame int
}

Fadable a mixin to make an object fade in/out when toggled. Must be initialized _after_ alpha and contents are set by the entity.

func (*Fadable) Init

func (f *Fadable) Init(w *engine.World, sp *level.Spawnable, e *engine.Entity) error

func (*Fadable) SetState

func (f *Fadable) SetState(originator, predecessor *engine.Entity, state bool)

func (*Fadable) Update

func (f *Fadable) Update()

type Movable

type Movable struct {
	Settable
	Physics
	World  *engine.World
	Entity *engine.Entity

	Acceleration float64
	From, To     m.Pos

	AnimDir int
}

Movable a mixin to make an object move back/forth when toggled. Must be initialized _after_ alpha and contents are set by the entity. Is shown in the "off" state in the editor. It moves using physics using a set acceleration value.

func (*Movable) Init

func (v *Movable) Init(w *engine.World, s *level.Spawnable, e *engine.Entity, contents level.Contents) error

func (*Movable) Update

func (v *Movable) Update()

type Moving

type Moving struct {
	Physics
	TouchedSomething bool
}

Moving is a physics object with initial velocity. That's all.

func (*Moving) Init

func (v *Moving) Init(w *engine.World, s *level.Spawnable, e *engine.Entity, contents level.Contents, handleTouch func(engine.TraceResult)) error

type NonSolidTouchable

type NonSolidTouchable struct {
	World           *engine.World
	Entity          *engine.Entity
	NotifyUntouched bool
}

NonSolidTouchable implements the Touch handler for nonsolid entities. Overrides Update(), so if additional handling is desired, calls must be chained.

func (*NonSolidTouchable) Init

func (t *NonSolidTouchable) Init(w *engine.World, e *engine.Entity) error

func (*NonSolidTouchable) Update

func (t *NonSolidTouchable) Update()

type Physics

type Physics struct {
	World  *engine.World
	Entity *engine.Entity

	Contents     level.Contents
	OnGround     bool
	OnGroundVec  m.Delta // Vector that points "down" in gravity direction.
	GroundEntity *engine.Entity
	Velocity     m.Delta // An input to be set changed by caller.
	SubPixel     m.Delta
	IgnoreEnt    *engine.Entity
	// contains filtered or unexported fields
}

func (*Physics) HandleTouch

func (p *Physics) HandleTouch(trace engine.TraceResult)

func (*Physics) Init

func (p *Physics) Init(w *engine.World, e *engine.Entity, contents level.Contents, handleTouch func(trace engine.TraceResult))

func (*Physics) ModifyHitBoxCentered

func (p *Physics) ModifyHitBoxCentered(bySize m.Delta) m.Delta

func (*Physics) ReadContents

func (p *Physics) ReadContents() level.Contents

func (*Physics) ReadGroundEntity

func (p *Physics) ReadGroundEntity() *engine.Entity

func (*Physics) ReadOnGroundVec

func (p *Physics) ReadOnGroundVec() m.Delta

func (*Physics) ReadSubPixel

func (p *Physics) ReadSubPixel() m.Delta

func (*Physics) ReadVelocity

func (p *Physics) ReadVelocity() m.Delta

func (*Physics) Reset

func (p *Physics) Reset()

func (*Physics) SetVelocity

func (p *Physics) SetVelocity(velocity m.Delta)

func (*Physics) SetVelocityForJump

func (p *Physics) SetVelocityForJump(velocity m.Delta)

func (*Physics) Update

func (p *Physics) Update()

type Settable

type Settable struct {
	State  bool
	Invert bool
}

Settable implements the SetState handler for settable entities.

func (*Settable) Init

func (s *Settable) Init(sp *level.Spawnable) error

Init initializes the initial state of the entity.

func (*Settable) SetState

func (s *Settable) SetState(originator, predecessor *engine.Entity, state bool)

SetState changes the state of the entity.

type TargetSelection

type TargetSelection []string

func ParseTarget

func ParseTarget(target string) TargetSelection

Jump to

Keyboard shortcuts

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