game

package
v0.0.0-...-b42d170 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2022 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitImages

func InitImages()

InitImages initializes the game images.

func InitSounds

func InitSounds()

InitSounds initializes looping sounds.

Types

type Alien

type Alien struct {
	Object
	Character
	// contains filtered or unexported fields
}

Alien is a squishy fusion reactor boi.

func CreateAlien

func CreateAlien(p Position, s Speed) *Alien

CreateAlien creates an alien at a position.

func (*Alien) Draw

func (a *Alien) Draw(screen *ebiten.Image, op *ebiten.DrawImageOptions, g *Game)

Draw draws the alien.

func (*Alien) Update

func (a *Alien) Update(g *Game)

Update updates the the alien's state.

type Character

type Character interface {
	Up()
	Down()
	Left()
	Right()
	Cw()
	Ccw()
	Attack()
	AltAttack()
	Die()
}

Character is a controllable character in the game.

type Element

type Element interface {
	Update(g *Game)
	Draw(screen *ebiten.Image, op *ebiten.DrawImageOptions, g *Game)
}

Element is a visual element within the game.

type Game

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

Game is a game struct for the ebiten game engine.

func (*Game) Draw

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

Draw draws the game on the screen.

func (*Game) Layout

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

Layout is the visual layout of the game screen.

func (*Game) Start

func (g *Game) Start()

Start begins the game.

func (*Game) Update

func (g *Game) Update() error

Update updates the logical state of the game.indo

type Missile

type Missile struct {
	Object
	// contains filtered or unexported fields
}

Missile is a missile object.

func CreateMissile

func CreateMissile(p Position, s Speed) *Missile

CreateMissile created at a position with a speed.

func (*Missile) Draw

func (m *Missile) Draw(screen *ebiten.Image, op *ebiten.DrawImageOptions, g *Game)

Draw draws the missile on the screen.

func (*Missile) Update

func (m *Missile) Update(g *Game)

Update updates the missile's state.

type Object

type Object struct {
	Element
	Speed
	Position
	Mass  float64
	Image *ebiten.Image
}

Object is a physical object in the game.

func (*Object) NewtonsFirstLaw

func (o *Object) NewtonsFirstLaw()

NewtonsFirstLaw applies newton's first law to an object. Objects in motion will stay in motion.

type Position

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

Position is a positon in the game.

type Ship

type Ship struct {
	Object
	// contains filtered or unexported fields
}

Ship is a space ship.

func CreateShip

func CreateShip(p Position, s Speed) *Ship

CreateShip creates an initialized ship at a position with speed.

func (*Ship) ClockwiseThrustersOff

func (s *Ship) ClockwiseThrustersOff()

ClockwiseThrustersOff turns the clockwise thrusters off.

func (*Ship) ClockwiseThrustersOn

func (s *Ship) ClockwiseThrustersOn()

ClockwiseThrustersOn turns the clockwise thrusters on.

func (*Ship) CounterClockwiseThrustersOff

func (s *Ship) CounterClockwiseThrustersOff()

CounterClockwiseThrustersOff turns the counter clockwise thrusters off.

func (*Ship) CounterClockwiseThrustersOn

func (s *Ship) CounterClockwiseThrustersOn()

CounterClockwiseThrustersOn turns the counter clockwise thrusters on.

func (*Ship) Draw

func (s *Ship) Draw(screen *ebiten.Image, op *ebiten.DrawImageOptions, g *Game)

Draw draws the ship in the screen.

func (*Ship) FireMissile

func (s *Ship) FireMissile(g *Game)

FireMissile fires a missile from ship. If ship is out of missiles, a warning sound is played.

func (*Ship) ForwardThrustersOff

func (s *Ship) ForwardThrustersOff()

ForwardThrustersOff turns the forward thrusters off.

func (*Ship) ForwardThrustersOn

func (s *Ship) ForwardThrustersOn()

ForwardThrustersOn turns the forward thrusters on.

func (*Ship) LeftThrustersOff

func (s *Ship) LeftThrustersOff()

LeftThrustersOff turns the left thrusters off.

func (*Ship) LeftThrustersOn

func (s *Ship) LeftThrustersOn()

LeftThrustersOn turns the left thrusters on.

func (*Ship) ReverseThrustersOff

func (s *Ship) ReverseThrustersOff()

ReverseThrustersOff turns the reverse thrusters off.

func (*Ship) ReverseThrustersOn

func (s *Ship) ReverseThrustersOn()

ReverseThrustersOn turns the reverse thrusters on.

func (*Ship) RightThrustersOff

func (s *Ship) RightThrustersOff()

RightThrustersOff turns the right thrusters off.

func (*Ship) RightThrustersOn

func (s *Ship) RightThrustersOn()

RightThrustersOn turns the right thrusters on.

func (*Ship) Update

func (s *Ship) Update(g *Game)

Update updates the ship's state.

type Speed

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

Speed is an x, y and rotational speed in the game.

type ViewPort

type ViewPort struct {
	Position
	Speed
	// contains filtered or unexported fields
}

ViewPort is a window a player sees through.

func NewViewPort

func NewViewPort(p Position) *ViewPort

NewViewPort initializes a new view port.

func (*ViewPort) FollowAheadXY

func (vp *ViewPort) FollowAheadXY(o Object)

FollowAheadXY position of object

func (*ViewPort) FollowAheadXYR

func (vp *ViewPort) FollowAheadXYR(o Object)

FollowAheadXYR position of object

func (*ViewPort) LockXY

func (vp *ViewPort) LockXY(o Object)

LockXY position of viewport to object

func (*ViewPort) LockXYR

func (vp *ViewPort) LockXYR(o Object)

LockXYR position of viewport to object

func (*ViewPort) Max

func (vp *ViewPort) Max() (float64, float64)

Max position visible on viewport

func (*ViewPort) Orient

func (vp *ViewPort) Orient(op *ebiten.DrawImageOptions)

Orient drawing options according to viewport

Jump to

Keyboard shortcuts

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