spaceinvaders

package
v0.0.0-...-8d17064 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetRenderedStringLengthInPixels

func GetRenderedStringLengthInPixels(str string, fnt font.Face) (int, int)

Types

type Enemy

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

func NewEnemy

func NewEnemy(x, y float64) *Enemy

func (*Enemy) FireProjectile

func (e *Enemy) FireProjectile() *Projectile

func (*Enemy) IsHit

func (e *Enemy) IsHit(projectileRect image.Rectangle) bool

func (*Enemy) OnScreenRect

func (e *Enemy) OnScreenRect() image.Rectangle

func (*Enemy) Update

func (e *Enemy) Update()

type Game

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

func NewGame

func NewGame() (*Game, error)

func (*Game) Draw

func (g *Game) Draw(screen *ebiten.Image)

func (*Game) Layout

func (g *Game) Layout(outsideWidth, outsideHeight int) (screenWidth, screenHeight int)

func (*Game) Reset

func (g *Game) Reset()

func (*Game) Update

func (g *Game) Update() error

type Input

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

func NewInput

func NewInput() *Input

func (*Input) Fire

func (i *Input) Fire() bool

func (*Input) MoveShip

func (i *Input) MoveShip() ShipDirection

type Mode

type Mode int
const (
	ScreenWidth       = 1024
	ScreenHeight      = 768
	ModeTitle    Mode = iota
	ModeGame
	ModeGameOver
)

type Player

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

func NewPlayer

func NewPlayer(x, y float64) *Player

func (*Player) FireProjectile

func (p *Player) FireProjectile() *Projectile

func (*Player) IsHit

func (p *Player) IsHit(projectileRect image.Rectangle) bool

func (*Player) OnScreenRect

func (p *Player) OnScreenRect() image.Rectangle

type Projectile

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

func NewProjectile

func NewProjectile(x, y float64, bt projectileType) *Projectile

func (*Projectile) OnScreenRect

func (p *Projectile) OnScreenRect() image.Rectangle

func (*Projectile) Update

func (p *Projectile) Update() bool

type ShipDirection

type ShipDirection int
const (
	NoMovement ShipDirection = iota
	MoveShipLeft
	MoveShipRight
)

Jump to

Keyboard shortcuts

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