sprites

package
v0.0.0-...-fde13e9 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Large = iota
	Medium
	Small
)

Variables

View Source
var AlienSpaceShip = sprite(spriteSheet, 416, 160, 96, 80)
View Source
var Bullet1 = sprite(spriteSheet, 448, 286, 32, 32)
View Source
var Bullet2 = sprite(spriteSheet, 480, 286, 32, 32)
View Source
var LargeAsteroids = []*ebiten.Image{
	sprite(spriteSheet, 0, 0, 160, 160),
	sprite(spriteSheet, 160, 0, 160, 160),
	sprite(spriteSheet, 320, 0, 160, 160),
}

2x

View Source
var MediumAsteroids = []*ebiten.Image{
	sprite(spriteSheet, 0, 160, 80, 96),
	sprite(spriteSheet, 96, 160, 80, 96),
	sprite(spriteSheet, 192, 160, 80, 96),
}
View Source
var SmallAsteroids = []*ebiten.Image{
	sprite(spriteSheet, 0, 254, 64, 64),
	sprite(spriteSheet, 64, 254, 64, 64),
	sprite(spriteSheet, 128, 254, 64, 64),
}
View Source
var SpaceShip1 = sprite(spriteSheet, 192, 254, 96, 64)
View Source
var SpaceShip2 = sprite(spriteSheet, 288, 254, 96, 64)

Functions

func Asteroid

func Asteroid(size int) *ebiten.Image

func Bullet

func Bullet(size int) *ebiten.Image

func Centre

func Centre(sprite *ebiten.Image) geometry.Vector

func Size

func Size(sprite *ebiten.Image) *geometry.Dimension

Types

type Sprite

type Sprite struct {
	Position    *geometry.Vector
	Velocity    *geometry.Vector
	Orientation float64
	Direction   float64
	Speed       float64
	Rotation    float64
	Centre      *geometry.Vector
	Size        *geometry.Dimension
	Image       *ebiten.Image

	ColorModel  colorm.ColorM
	DrawOptions *colorm.DrawImageOptions
	// contains filtered or unexported fields
}

func NewSprite

func NewSprite(screenBounds *geometry.Dimension, image *ebiten.Image, wraparound bool) *Sprite

func (*Sprite) Draw

func (s *Sprite) Draw(screen *ebiten.Image)

func (*Sprite) MoveForward

func (s *Sprite) MoveForward(acceleration, maxSpeed float64)

func (*Sprite) Reset

func (s *Sprite) Reset()

func (*Sprite) Update

func (s *Sprite) Update() error

Jump to

Keyboard shortcuts

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