component

package
v0.0.0-...-84cadf2 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ShadowTag = donburi.NewTag()

	CurrentEvolutionTag = donburi.NewTag()
	NextEvolutionTag    = donburi.NewTag()

	Wreckable = donburi.NewTag()
)

Bounds indicates that the entity can't move of out the screen.

View Source
var Health = donburi.NewComponentType[HealthData](HealthData{
	DamageIndicatorTimer: engine.NewTimer(time.Millisecond * 100),
})

Functions

func ClosestTarget

func ClosestTarget(w donburi.World, entry *donburi.Entry, lookFor *query.Query) *donburi.Entry

func MustFindLevel

func MustFindLevel(w donburi.World) *donburi.Entry

Types

type AIData

type AIData struct {
	Type AIType

	Speed float64

	StartedMoving bool

	Path       []math.Vec2
	PathLoops  bool
	NextTarget int
}

type AIType

type AIType int
const (
	AITypeConstantVelocity AIType = iota
	AITypeFollowPath
)

type AltitudeData

type AltitudeData struct {
	// Altitude is the level above the ground, in percent.
	// 0.0 is ground level, 1.0 is the highest point.
	Altitude float64
	Velocity float64

	// TODO: Not sure if this fits this component
	Falling bool
}

func (*AltitudeData) Update

func (a *AltitudeData) Update()

type BoundsData

type BoundsData struct {
	Disabled bool
}

type CameraData

type CameraData struct {
	Moving    bool
	MoveTimer *engine.Timer
}

type CollectibleData

type CollectibleData struct {
	Type CollectibleType
}

type CollectibleType

type CollectibleType int
const (
	CollectibleTypeHealth CollectibleType = iota
	CollectibleTypeWeaponUpgrade
	CollectibleTypeShield
)

type ColliderData

type ColliderData struct {
	Width  float64
	Height float64
	Layer  ColliderLayer
}

type ColliderLayer

type ColliderLayer int
const (
	CollisionLayerPlayerBullets ColliderLayer = iota
	CollisionLayerEnemyBullets
	CollisionLayerGroundEnemies
	CollisionLayerAirEnemies
	CollisionLayerPlayers
	CollisionLayerCollectibles
)

type ColorOverride

type ColorOverride struct {
	R, G, B, A float64
}

type DebugData

type DebugData struct {
	Enabled bool
}

type DespawnableData

type DespawnableData struct {
	// Set when the unit first appears on-screen
	Spawned bool
}

type EvolutionData

type EvolutionData struct {
	Level           int
	Evolving        bool
	StartedEvolving bool
	GrowTimer       *engine.Timer
	ShrinkTimer     *engine.Timer
}

func (*EvolutionData) Evolve

func (e *EvolutionData) Evolve()

func (*EvolutionData) StopEvolving

func (e *EvolutionData) StopEvolving()

type FollowerData

type FollowerData struct {
	Target         *donburi.Entry
	FollowingSpeed float64
	FollowingTimer *engine.Timer
}

type GameData

type GameData struct {
	Score    int
	Paused   bool
	GameOver bool
	Settings Settings
}

func MustFindGame

func MustFindGame(w donburi.World) *GameData

func (*GameData) AddScore

func (d *GameData) AddScore(score int)

type HealthData

type HealthData struct {
	Health               int
	JustDamaged          bool
	DamageIndicatorTimer *engine.Timer
	DamageIndicator      *SpriteData
}

func (*HealthData) Damage

func (d *HealthData) Damage()

func (*HealthData) HideDamageIndicator

func (d *HealthData) HideDamageIndicator()

type InputData

type InputData struct {
	Disabled bool

	MoveUpKey    ebiten.Key
	MoveRightKey ebiten.Key
	MoveDownKey  ebiten.Key
	MoveLeftKey  ebiten.Key
	MoveSpeed    float64

	ShootKey ebiten.Key
}

type LabelData

type LabelData struct {
	Text   string
	Hidden bool
}

type LevelData

type LevelData struct {
	ProgressionTimer *engine.Timer
	ReachedEnd       bool
	Progressed       bool
}

type ObserverData

type ObserverData struct {
	LookFor *query.Query
	Target  *donburi.Entry
}

type PlayerAirplaneData

type PlayerAirplaneData struct {
	PlayerNumber int
	// TODO Duplicated across PlayerAirplane and Player?
	Faction PlayerFaction

	Invulnerable          bool
	InvulnerableTimer     *engine.Timer
	InvulnerableIndicator *SpriteData
}

func (*PlayerAirplaneData) StartInvulnerability

func (d *PlayerAirplaneData) StartInvulnerability()

func (*PlayerAirplaneData) StopInvulnerability

func (d *PlayerAirplaneData) StopInvulnerability()

type PlayerData

type PlayerData struct {
	PlayerNumber  int
	PlayerFaction PlayerFaction

	Lives        int
	Respawning   bool
	RespawnTimer *engine.Timer

	WeaponLevel WeaponLevel
	ShootTimer  *engine.Timer
}

func (*PlayerData) AddLive

func (d *PlayerData) AddLive()

func (*PlayerData) Damage

func (d *PlayerData) Damage()

func (*PlayerData) EvolutionLevel

func (d *PlayerData) EvolutionLevel() int

func (*PlayerData) UpgradeWeapon

func (d *PlayerData) UpgradeWeapon()

func (*PlayerData) WeaponCooldown

func (d *PlayerData) WeaponCooldown() time.Duration

type PlayerFaction

type PlayerFaction int
const (
	PlayerFactionBlue PlayerFaction = iota
	PlayerFactionRed
	PlayerFactionGreen
	PlayerFactionYellow
)

func MustPlayerFactionFromString

func MustPlayerFactionFromString(s string) PlayerFaction

type PlayerSelectData

type PlayerSelectData struct {
	Index   int
	Faction PlayerFaction

	Selected     bool
	Ready        bool
	PlayerNumber int
}

func (*PlayerSelectData) LockIn

func (p *PlayerSelectData) LockIn()

func (*PlayerSelectData) Release

func (p *PlayerSelectData) Release()

func (*PlayerSelectData) Select

func (p *PlayerSelectData) Select(playerNumber int)

func (*PlayerSelectData) Unselect

func (p *PlayerSelectData) Unselect()

type ScriptData

type ScriptData struct {
	Update func(w donburi.World)
}

type Settings

type Settings struct {
	ScreenWidth  int
	ScreenHeight int
}

type ShooterData

type ShooterData struct {
	Type       ShooterType
	ShootTimer *engine.Timer
}

type ShooterType

type ShooterType int
const (
	ShooterTypeBullet ShooterType = iota
	ShooterTypeMissile
	ShooterTypeBeam
)

type SpawnFunc

type SpawnFunc func(w donburi.World)

type SpawnableData

type SpawnableData struct {
	SpawnFunc SpawnFunc
}

type SpriteData

type SpriteData struct {
	Image *ebiten.Image
	Layer SpriteLayer
	Pivot SpritePivot

	// The original rotation of the sprite
	// "Facing right" is considered 0 degrees
	OriginalRotation float64

	Hidden bool

	ColorOverride *ColorOverride
}

func (*SpriteData) Hide

func (s *SpriteData) Hide()

func (*SpriteData) Show

func (s *SpriteData) Show()

type SpriteLayer

type SpriteLayer int
const (
	SpriteLayerBackground SpriteLayer = iota
	SpriteLayerDebris
	SpriteLayerGroundUnits
	SpriteLayerGroundGuns
	SpriteLayerShadows
	SpriteLayerCollectibles
	SpriteLayerFallingWrecks
	SpriteLayerAirUnits
	SpriteLayerIndicators
)

type SpritePivot

type SpritePivot int
const (
	SpritePivotCenter SpritePivot = iota
	SpritePivotTopLeft
)

type VelocityData

type VelocityData struct {
	Velocity         math.Vec2
	RotationVelocity float64
}

type WeaponLevel

type WeaponLevel int
const (
	WeaponLevelSingle WeaponLevel = iota
	WeaponLevelSingleFast
	WeaponLevelDouble
	WeaponLevelDoubleFast
	WeaponLevelDiagonal
	WeaponLevelDoubleDiagonal
)

Jump to

Keyboard shortcuts

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