Documentation
¶
Index ¶
Constants ¶
View Source
const BoxSize = 5
BoxSize is based on the box sprite visual dimensions
View Source
const ProjSize = 2 // How big a projectile's hitbox is
View Source
const TailDist = 1 // Distance between projectile and tail
View Source
const TailMax = 10 // Maximum length of projectile tail
Variables ¶
View Source
var Context *audio.Context
View Source
var HighScore int = 0
Using globals vs meeting deadlines
Functions ¶
func IsMainActionButtonPressed ¶
Main action button is 5, like in the middle of a Nokia 3310 Fallbacks for people without a numpad:
- Spacebar on desktop
- Tap the screen on mobile
func NewTextRenderer ¶ added in v0.4.0
Types ¶
type Box ¶
type Box struct {
Coords image.Point
Chute bool
HitBox image.Rectangle
State boxAnimationTags // Current animation state
Frame int // Current animation frame
Sprite *assets.SpriteSheet
Tick int
// contains filtered or unexported fields
}
Box is the player character in the game
type EOS ¶
type EOS struct {
NextScreen Screen
}
EOS is an End Of Screen error This means the screen's logic has terminated and the controlling game should switch to a different screen
type GameScreen ¶
type GameScreen struct {
Box *Box
Dusts Dusts
Projectiles Projectiles
Tick int
TouchIDs *[]ebiten.TouchID
SFXHit *audio.Player
}
GameScreen represents state for the game proper
func NewGameScreen ¶
func NewGameScreen(touchIDs *[]ebiten.TouchID) *GameScreen
func (*GameScreen) Draw ¶
func (g *GameScreen) Draw(screen *ebiten.Image)
func (*GameScreen) Update ¶
func (g *GameScreen) Update() error
type Point ¶ added in v1.0.1
type Point struct {
X, Y float64
}
Point is X, Y coordinates in 2D space, like image.Point but with floats
type Projectile ¶
type Projectile struct {
Coords Point
Tail int
Size int
Velocity float64 // Direction and speed
Spacing int // How far away to place the next one
}
Projectile is something that flies across the screen and causes damage if it hits the box
func (*Projectile) Draw ¶
func (p *Projectile) Draw(screen *ebiten.Image)
func (*Projectile) MoveUp ¶
func (p *Projectile) MoveUp()
func (*Projectile) Update ¶
func (p *Projectile) Update()
type Projectiles ¶
type Projectiles []*Projectile
func (*Projectiles) Draw ¶
func (ps *Projectiles) Draw(screen *ebiten.Image)
func (*Projectiles) Drop ¶
func (ps *Projectiles) Drop(i int)
func (*Projectiles) MoveUp ¶
func (ps *Projectiles) MoveUp()
func (*Projectiles) Spawn ¶ added in v0.3.1
func (ps *Projectiles) Spawn(tick int)
func (*Projectiles) Update ¶
func (ps *Projectiles) Update(tick int)
type TitleScreen ¶
type TitleScreen struct {
Background *ebiten.Image
TouchIDs *[]ebiten.TouchID
Music *audio.Player
SFXFall *audio.Player
Box *Box
TextRenderer *etxt.Renderer
}
func NewTitleScreen ¶ added in v0.4.0
func NewTitleScreen(touchIDs *[]ebiten.TouchID) *TitleScreen
func (*TitleScreen) Draw ¶
func (t *TitleScreen) Draw(screen *ebiten.Image)
func (*TitleScreen) Update ¶
func (t *TitleScreen) Update() error
Click to show internal directories.
Click to hide internal directories.