flappy

package
v0.0.0-...-376e9ab Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2020 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BirdSize    = 30
	Gravity     = 0.35
	Jump        = 6.9
	MaxVelocity = 9
)
View Source
const (
	Width  = 800
	Height = 900
)
View Source
const (
	GroundHeight = 100
	GrassHeight  = 5
)
View Source
const (
	PipeWidth     = 70
	PipeHeight    = Height / 2
	PipeBorder    = 3
	VerticalGap   = 120
	HorizontalGap = 230
	Speed         = 2.3
)
View Source
const PipesBuffer = 3

Variables

This section is empty.

Functions

This section is empty.

Types

type Bird

type Bird struct {
	rl.Rectangle
	Velocity float32
}

Bird is a bird

func NewBird

func NewBird(x, y int) *Bird

func (*Bird) AboveSky

func (b *Bird) AboveSky() bool

func (*Bird) Draw

func (bird *Bird) Draw(color rl.Color)

func (*Bird) Jump

func (b *Bird) Jump()

func (*Bird) Update

func (bird *Bird) Update()

type Game

type Game struct {
	Bird   *Bird
	Ground *Ground
	Score  int
	Over   bool
	Pipes  []*Pipe
}

Game is a game

func NewGame

func NewGame() *Game

func (*Game) Draw

func (g *Game) Draw()

func (*Game) Init

func (g *Game) Init()

func (*Game) Update

func (g *Game) Update()

type Ground

type Ground struct {
	rl.Rectangle
}

Ground is ground

func NewGround

func NewGround() *Ground

NewGround is a ctor for ground

func (*Ground) CollidesWith

func (ground *Ground) CollidesWith(other rl.Rectangle) bool

func (*Ground) Draw

func (ground *Ground) Draw()

type Pipe

type Pipe struct {
	rl.Rectangle
	HasPassedThrough bool
}

Pipe is a pipe

func NewPipe

func NewPipe(x, y int) *Pipe

func (*Pipe) CollidesWith

func (p *Pipe) CollidesWith(other rl.Rectangle) bool

func (*Pipe) Draw

func (pipe *Pipe) Draw()

func (*Pipe) IsAround

func (p *Pipe) IsAround(other rl.Rectangle) bool

func (*Pipe) IsOffscreen

func (p *Pipe) IsOffscreen() bool

Jump to

Keyboard shortcuts

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