trigger

package
v1.5.54 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AppearFrames         = 16
	AppearXDistance      = 2 * level.TileSize
	AppearYDistance      = level.TileSize / 4
	AppearSolidThreshold = 12
)
View Source
const (
	DisappearFrames         = 24
	DisappearSolidThreshold = 1
)
View Source
const (
	UseFramesPerPixel = 2
	UsePixels         = 4
)
View Source
const (
	RespawnHitboxBorder = 4 // Actually only the 8x8 center square of the 16x16 sprite.
)

Let's do a somewhat forgiving hitbox.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppearBlock

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

	AnimFrame int
}

AppearBlock is a simple entity type that renders a static sprite. It can be optionally solid and/or opaque.

func (*AppearBlock) Despawn

func (a *AppearBlock) Despawn()

func (*AppearBlock) Spawn

func (*AppearBlock) Touch

func (a *AppearBlock) Touch(other *engine.Entity)

func (*AppearBlock) Update

func (a *AppearBlock) Update()

type DisappearBlock

type DisappearBlock struct {
	mixins.Settable
	World  *engine.World
	Entity *engine.Entity

	Disappearing bool
	AnimFrame    int
}

DisappearBlock is an entity that disappears when touched and never reappears.

func (*DisappearBlock) Despawn

func (a *DisappearBlock) Despawn()

func (*DisappearBlock) Spawn

func (*DisappearBlock) Touch

func (a *DisappearBlock) Touch(other *engine.Entity)

func (*DisappearBlock) Update

func (a *DisappearBlock) Update()

type ForceField

type ForceField struct {
	mixins.NonSolidTouchable
	World  *engine.World
	Entity *engine.Entity

	AlphaMod  float64
	AnimFrame int
	Active    bool

	TouchedFrame int
	ShockSound   *sound.Sound
	SourceImg    *ebiten.Image
}

ForceField, when hit by the player, sends the player away from it.

func (*ForceField) Despawn

func (f *ForceField) Despawn()

func (*ForceField) Spawn

func (f *ForceField) Spawn(w *engine.World, sp *level.SpawnableProps, e *engine.Entity) error

func (*ForceField) Touch

func (f *ForceField) Touch(other *engine.Entity)

func (*ForceField) Update

func (f *ForceField) Update()

type Give

type Give struct {
	mixins.NonSolidTouchable

	Ability   string
	Text      string
	AnimFrame int

	Anim animation.State
}

Give grants the player an ability when touched.

func (*Give) Despawn

func (g *Give) Despawn()

func (*Give) Spawn

func (g *Give) Spawn(w *engine.World, sp *level.SpawnableProps, e *engine.Entity) error

func (*Give) Touch

func (g *Give) Touch(other *engine.Entity)

func (*Give) Update

func (g *Give) Update()

type JumpPad

type JumpPad struct {
	mixins.NonSolidTouchable
	World  *engine.World
	Entity *engine.Entity

	Destination m.Pos
	Height      int

	TouchedFrame int
	JumpSound    *sound.Sound
}

JumpPad, when hit by the player, sends the player on path to set destination. Note that sadly, JumpPads are rarely ever useful in rooms that can be used in multiple orientations. May want to introduce required orientation like with checkpoints. Or could require player to hit jumppad from above.

func (*JumpPad) Despawn

func (j *JumpPad) Despawn()

func (*JumpPad) Spawn

func (j *JumpPad) Spawn(w *engine.World, sp *level.SpawnableProps, e *engine.Entity) error

func (*JumpPad) Touch

func (j *JumpPad) Touch(other *engine.Entity)

func (*JumpPad) Update

func (j *JumpPad) Update()

type OneWay

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

	AllowedDirection m.Delta

	Anim animation.State
}

OneWay is an entity that can only be passed in one direction. It is implemented simply as being solid whenever it is on the left (or rotated direction) of the player.

func (*OneWay) Despawn

func (o *OneWay) Despawn()

func (*OneWay) Spawn

func (o *OneWay) Spawn(w *engine.World, sp *level.SpawnableProps, e *engine.Entity) error

func (*OneWay) Touch

func (o *OneWay) Touch(other *engine.Entity)

func (*OneWay) Update

func (o *OneWay) Update()

type QuestionBlock

type QuestionBlock struct {
	World           *engine.World
	Entity          *engine.Entity
	PersistentState propmap.Map

	Kaizo  bool
	Target mixins.TargetSelection

	Used         bool
	UsedImage    *ebiten.Image
	UseAnimFrame int

	Sound *sound.Sound
}

QuestionBlock is a simple entity type that renders a static sprite. It can be optionally solid and/or opaque.

func (*QuestionBlock) Despawn

func (q *QuestionBlock) Despawn()

func (*QuestionBlock) Spawn

func (*QuestionBlock) Touch

func (q *QuestionBlock) Touch(other *engine.Entity)

func (*QuestionBlock) Update

func (q *QuestionBlock) Update()

type RespawnPlayer

type RespawnPlayer struct {
	World *engine.World
}

RespawnPlayer respawns the player when touched.

func (*RespawnPlayer) Despawn

func (r *RespawnPlayer) Despawn()

func (*RespawnPlayer) Spawn

func (*RespawnPlayer) Touch

func (r *RespawnPlayer) Touch(other *engine.Entity)

func (*RespawnPlayer) Update

func (r *RespawnPlayer) Update()

type SetState

type SetState struct {
	World  *engine.World
	Entity *engine.Entity
	mixins.NonSolidTouchable
	target.SetStateTarget

	SendUntouch bool
	SendOnce    bool
	PlayerOnly  bool

	Touching   bool
	Touched    bool
	State      bool
	Originator *engine.Entity
}

SetState overrides the boolean state of a warpzone or entity.

func (*SetState) Despawn

func (s *SetState) Despawn()

func (*SetState) Spawn

func (s *SetState) Spawn(w *engine.World, sp *level.SpawnableProps, e *engine.Entity) error

func (*SetState) Touch

func (s *SetState) Touch(other *engine.Entity)

func (*SetState) Update

func (s *SetState) Update()

type Switch

type Switch struct {
	SetState
	Entity    *engine.Entity
	Anim      animation.State
	AnimState bool

	SwitchOn, SwitchOff *sound.Sound
}

Switch overrides the boolean state of a warpzone or entity.

func (*Switch) Spawn

func (s *Switch) Spawn(w *engine.World, sp *level.SpawnableProps, e *engine.Entity) error

func (*Switch) Update

func (s *Switch) Update()

type SwitchMusic

type SwitchMusic struct {
	mixins.NonSolidTouchable
	target.SwitchMusicTarget
}

SwitchMusic just changes the music track to the given one.

func (*SwitchMusic) Despawn

func (s *SwitchMusic) Despawn()

func (*SwitchMusic) Spawn

func (*SwitchMusic) Touch

func (s *SwitchMusic) Touch(other *engine.Entity)

func (*SwitchMusic) Update

func (s *SwitchMusic) Update()

type SwitchableJumpPad

type SwitchableJumpPad struct {
	mixins.Settable
	JumpPad
}

JumpPad, when hit by the player, sends the player on path to set destination. Note that sadly, JumpPads are rarely ever useful in rooms that can be used in multiple orientations. May want to introduce required orientation like with checkpoints. Or could require player to hit jumppad from above.

func (*SwitchableJumpPad) Spawn

func (*SwitchableJumpPad) Touch

func (j *SwitchableJumpPad) Touch(other *engine.Entity)

type TnihSign

type TnihSign struct {
	mixins.NonSolidTouchable
	World           *engine.World
	Entity          *engine.Entity
	PersistentState propmap.Map

	Text      string
	SeenImage *ebiten.Image
	Sound     *sound.Sound
	Target    mixins.TargetSelection

	Touching bool
	Touched  bool

	Centerprint *centerprint.Centerprint
}

TnihSign just displays a text and remembers that it was hit.

func (*TnihSign) Despawn

func (t *TnihSign) Despawn()

func (*TnihSign) Precache added in v1.3.43

func (t *TnihSign) Precache(sp *level.Spawnable) error

func (*TnihSign) Spawn

func (t *TnihSign) Spawn(w *engine.World, sp *level.SpawnableProps, e *engine.Entity) error

func (*TnihSign) Touch

func (t *TnihSign) Touch(other *engine.Entity)

func (*TnihSign) Update

func (t *TnihSign) Update()

type VVVVVV

type VVVVVV struct {
	mixins.NonSolidTouchable

	State                bool
	VVVVVVGravityFlip    bool
	NormalGravityFlip    bool
	VVVVVVVelocityFactor float64
	NormalVelocityFactor float64
}

VVVVVV enables/disables gravity flipping when jumping through.

func (*VVVVVV) Despawn

func (v *VVVVVV) Despawn()

func (*VVVVVV) Spawn

func (v *VVVVVV) Spawn(w *engine.World, sp *level.SpawnableProps, e *engine.Entity) error

func (*VVVVVV) Touch

func (v *VVVVVV) Touch(other *engine.Entity)

func (*VVVVVV) Update

func (v *VVVVVV) Update()

Jump to

Keyboard shortcuts

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