models

package
v0.0.0-...-cc1763f Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	InitPaddleHeight = 100.0
	InitPaddleWidth  = 10.0
)
View Source
const (
	InitBallRadius = 5.0
)

Variables

View Source
var (
	Font1 font.Face
)

Functions

func Draw

func Draw(state GameState, player1 *Paddle, player2 *Paddle, color color.Color, screen *ebiten.Image)

Types

type Ball

type Ball struct {
	Position
	Radius float32
	Color  color.Color
	Img    *ebiten.Image
	Xv, Yv float32
	Step   float32
}

func (*Ball) Draw

func (b *Ball) Draw(screen *ebiten.Image)

func (*Ball) Update

func (b *Ball) Update(w int, h int, leftPaddle *Paddle, rightPaddle *Paddle)

type GameState

type GameState byte
const (
	StartState GameState = iota
	PlayState
	InterState
	GameOverState
)

type Paddle

type Paddle struct {
	Position
	H, W  float32
	Yv    float32
	Color color.Color
	Img   *ebiten.Image

	Up        ebiten.Key
	Down      ebiten.Key
	Score     int
	LastPoint bool
	Winner    bool
	// contains filtered or unexported fields
}

func (*Paddle) Draw

func (p *Paddle) Draw(screen *ebiten.Image)

func (*Paddle) Update

func (p *Paddle) Update(w, h int)

type Position

type Position struct {
	X, Y float32
}

Jump to

Keyboard shortcuts

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