mypong

package module
v0.0.0-...-18ba178 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2024 License: MIT Imports: 12 Imported by: 0

README

mypong

A customized version of the famous pong video game, as a practical exercise to discover the ebiten go game librairy.

Documentation

Index

Constants

View Source
const RADIUS = 2
View Source
const SAMPLERATE = 48000
View Source
const XMAX, YMAX = 320, 240 // logical game space dimensions

Variables

This section is empty.

Functions

func PlayAudioBoing

func PlayAudioBoing()

PlayAudioBoing creates a player and plays the boing file

func UpdateAudioBackground

func UpdateAudioBackground()

Plays rain sound in a loop, using a single player Should be called within the update loop.

Types

type Ball

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

func NewBall

func NewBall() *Ball

func (*Ball) Draw

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

func (*Ball) Update

func (ball *Ball) Update(p *Pong) error

Update implements ebiten.Game.

type Paddle

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

func NewPaddle

func NewPaddle() *Paddle

Creates a new default paddle

func (*Paddle) Collide

func (paddle *Paddle) Collide(p *Pong, b *Ball)

Manage ball/paddle interactions

func (*Paddle) Draw

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

func (*Paddle) Update

func (paddle *Paddle) Update(p *Pong) error

type Pong

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

func NewPong

func NewPong() *Pong

func (*Pong) Draw

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

Draw implements ebiten.Game. Draw draws the game screen.

func (*Pong) Layout

func (*Pong) Layout(outsideWidth int, outsideHeight int) (screenWidth int, screenHeight int)

Layout implements ebiten.Game. Layout takes the outside size (e.g., the window size) and returns the (logical) screen size.

func (*Pong) Update

func (p *Pong) Update() error

Update implements ebiten.Game.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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