bullet

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2022 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BulletNone = iota
	BulletPlain
)
View Source
const (
	BehaviorNone = iota
	BehaviorLinear
	BehaviorBoomerang
	BehaviorCircle
	BehaviorLasso
	BehaviorWave
	BehaviorUp
	BehaviorKnockback
)

Variables

This section is empty.

Functions

func Clear

func Clear()

func Draw

func Draw(screen *ebiten.Image) error

func HitUpdate

func HitUpdate()

func MoveToFront

func MoveToFront(bullet *Bullet)

func Update

func Update()

Types

type Bullet

type Bullet struct {
	// contains filtered or unexported fields
}

func At

func At(x, y float64) *Bullet

func Bullets

func Bullets() []*Bullet

func HID

func HID(hid string) *Bullet

func Key

func Key(index int) *Bullet

func New

func New(b *BulletData, player entity.Entiter, direction int, lifespan time.Time, spawnCount int) (*Bullet, error)

func (*Bullet) AnimationAttack

func (n *Bullet) AnimationAttack() error

func (*Bullet) AnimationGotHit

func (n *Bullet) AnimationGotHit() error

func (*Bullet) Draw

func (n *Bullet) Draw(screen *ebiten.Image) error

func (*Bullet) EntityID

func (n *Bullet) EntityID() uint

func (*Bullet) HID

func (n *Bullet) HID() string

func (*Bullet) IsDead

func (n *Bullet) IsDead() bool

func (*Bullet) IsHit

func (n *Bullet) IsHit(x, y float64) bool

func (*Bullet) Position

func (n *Bullet) Position() (float64, float64)

func (*Bullet) SHeight

func (n *Bullet) SHeight() int

func (*Bullet) SWidth

func (n *Bullet) SWidth() int

func (*Bullet) SetAnimation

func (n *Bullet) SetAnimation(name string) error

SetAnimation sets the animation of the bullet

func (*Bullet) SetPosition

func (n *Bullet) SetPosition(x, y float64)

func (*Bullet) X

func (n *Bullet) X() float64

func (*Bullet) Y

func (n *Bullet) Y() float64

type BulletData

type BulletData struct {
	Damage           int       // Damage is the amount of damage dealt by the object
	SpriteName       string    // Sprite is the file name
	LayerName        string    // Layer is the layer on aseprite to use
	BehaviorType     int       // Behavior handles movement style
	Distance         float64   // Distance is how far a bullet will travel
	IsImmortal       bool      // Lifespam is unlimited if this is true
	Lifespan         time.Time // Lifespan is how long a bullet will be alive for, if IsImmortal is false
	MoveSpeed        float64   // MoveSpeed is how fast a bullet moves at
	SourceWeaponType int       // SourceWeaponType is the type of weapon that is the source of the bullet
	OffsetX          float64   // OffsetX is the bullet's offset on spawn
	OffsetY          float64   // OffsetY is the bullet's offset on spawn
}

Jump to

Keyboard shortcuts

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