component

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2021 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BulletComponentID = engine.Engine.NewComponentID()
View Source
var DestructibleComponentID = engine.Engine.NewComponentID()
View Source
var PositionComponentID = engine.Engine.NewComponentID()
View Source
var SpriteComponentID = engine.Engine.NewComponentID()
View Source
var VelocityComponentID = engine.Engine.NewComponentID()
View Source
var WeaponComponentID = engine.Engine.NewComponentID()

Functions

This section is empty.

Types

type BulletComponent

type BulletComponent struct {
}

func Bullet

func Bullet(ctx *gohan.Context) *BulletComponent

func (*BulletComponent) ComponentID

func (p *BulletComponent) ComponentID() gohan.ComponentID

type DestructibleComponent

type DestructibleComponent struct {
}

func Destructible

func Destructible(ctx *gohan.Context) *DestructibleComponent

func (*DestructibleComponent) ComponentID

func (p *DestructibleComponent) ComponentID() gohan.ComponentID

type PositionComponent

type PositionComponent struct {
	X, Y float64
}

func Position

func Position(ctx *gohan.Context) *PositionComponent

func (*PositionComponent) ComponentID

func (p *PositionComponent) ComponentID() gohan.ComponentID

type SpriteComponent

type SpriteComponent struct {
	Image          *ebiten.Image
	HorizontalFlip bool
	VerticalFlip   bool
	DiagonalFlip   bool // TODO unimplemented

	Overlay            *ebiten.Image
	OverlayX, OverlayY float64 // Overlay offset

	Frame     int
	Frames    []*ebiten.Image
	FrameTime time.Duration
	LastFrame time.Time
	NumFrames int

	OverrideColorScale bool
	ColorScale         float64
}

func Sprite

func Sprite(ctx *gohan.Context) *SpriteComponent

func (*SpriteComponent) ComponentID

func (p *SpriteComponent) ComponentID() gohan.ComponentID

type VelocityComponent

type VelocityComponent struct {
	X, Y float64
}

func Velocity

func Velocity(ctx *gohan.Context) *VelocityComponent

func (*VelocityComponent) ComponentID

func (c *VelocityComponent) ComponentID() gohan.ComponentID

type WeaponComponent

type WeaponComponent struct {
	Equipped bool

	Damage int

	FireRate time.Duration
	LastFire time.Time

	BulletSpeed float64
}

func Weapon

func Weapon(ctx *gohan.Context) *WeaponComponent

func (*WeaponComponent) ComponentID

func (p *WeaponComponent) ComponentID() gohan.ComponentID

Jump to

Keyboard shortcuts

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