invaders

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FirstMenuItem     = 0
	Play          int = iota - 1
	Highscores
	Howto
	NumMenuItems
)

Variables

This section is empty.

Functions

func NewStar

func NewStar(x int, y int, symbol rune, color string, speed float64) *matrix.Entity

Types

type Alien

type Alien struct {
	*matrix.Entity
	// contains filtered or unexported fields
}

func NewAlien

func NewAlien(idx int, x int, y int, sprite []string, reward int) *Alien

type Aliens

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

func NewAliens

func NewAliens() *Aliens

func (*Aliens) Create

func (a *Aliens) Create(x int, y int, offset int)

func (*Aliens) DoBulletCollision

func (a *Aliens) DoBulletCollision(bullet *matrix.Entity) (bool, int)

func (*Aliens) DoMove

func (a *Aliens) DoMove(w int, _ int)

func (*Aliens) Draw

func (a *Aliens) Draw(surface interfaces.ISurface)

func (*Aliens) MakeAliens

func (a *Aliens) MakeAliens(aliensHorizontal int, x int, y int, rows int, cols int, reward int, offset int, sprite []string) (int, int)

func (*Aliens) Setup

func (a *Aliens) Setup(w int, h int)

type Barricade

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

func NewBarricade

func NewBarricade() *Barricade

func (*Barricade) Draw

func (b *Barricade) Draw(surface interfaces.ISurface)

func (*Barricade) Get

func (b *Barricade) Get(x int, y int) int

func (*Barricade) Set

func (b *Barricade) Set(x int, y int, data int)

func (*Barricade) Setup

func (b *Barricade) Setup(w int, h int) *Barricade

func (*Barricade) Unset

func (b *Barricade) Unset(x int, y int) bool

type Bullet

type Bullet struct {
	*matrix.Entity
}

func NewBullet

func NewBullet(x int, y int, vy int) *Bullet

type Bullets

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

func NewBullets

func NewBullets() *Bullets

func (*Bullets) Draw

func (ab *Bullets) Draw(surface interfaces.ISurface)

func (*Bullets) Setup

func (ab *Bullets) Setup(num int)

func (*Bullets) Update

func (ab *Bullets) Update(x int, y int)

type ByScore

type ByScore []*HighScore

func (ByScore) Len

func (a ByScore) Len() int

func (ByScore) Less

func (a ByScore) Less(i, j int) bool

func (ByScore) Swap

func (a ByScore) Swap(i, j int)

type Fragment

type Fragment struct {
	matrix.Point
	// contains filtered or unexported fields
}

func NewFragment

func NewFragment(x int, y int, life int, fragments int) Fragment

type Fragments

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

func NewFragments

func NewFragments() *Fragments

func (*Fragments) AddFragment

func (f *Fragments) AddFragment(x int, y int)

func (*Fragments) Draw

func (f *Fragments) Draw(surface interfaces.ISurface)

func (*Fragments) Setup

func (f *Fragments) Setup()

func (*Fragments) Update

func (f *Fragments) Update()

type GameState

type GameState uint8
const (
	MenuState GameState = iota
	PlayState
	HighscoresState
)

type HighScore

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

type Invaders

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

func NewGame

func NewGame(w int, h int) *Invaders

func (*Invaders) Draw

func (g *Invaders) Draw(surface interfaces.ISurface)

func (*Invaders) GetSize

func (g *Invaders) GetSize() (int, int)

func (*Invaders) HandleKey

func (g *Invaders) HandleKey(k rune)

func (*Invaders) SetMenuState

func (g *Invaders) SetMenuState()

func (*Invaders) SetPlayState

func (g *Invaders) SetPlayState()

func (*Invaders) SetSize

func (g *Invaders) SetSize(w int, h int)

func (*Invaders) Update

func (g *Invaders) Update()

type Player

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

func NewPlayer

func NewPlayer(x int, y int) *Player

func (*Player) DecLives

func (player *Player) DecLives() bool

func (*Player) Draw

func (player *Player) Draw(surface interfaces.ISurface)

func (*Player) GetLivesStr

func (player *Player) GetLivesStr() string

func (*Player) HasCollision

func (player *Player) HasCollision(e *matrix.Entity) bool

func (*Player) MoveLeft

func (player *Player) MoveLeft(minW int)

func (*Player) MoveRight

func (player *Player) MoveRight(maxW int)

func (*Player) NewBullet

func (player *Player) NewBullet()

func (*Player) WipeBullet

func (player *Player) WipeBullet()

type Stars

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

func NewStars

func NewStars() *Stars

func (*Stars) Draw

func (s *Stars) Draw(surface interfaces.ISurface)

func (*Stars) Update

func (s *Stars) Update(w int, h int, fc uint8)

Jump to

Keyboard shortcuts

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