game

package
v0.0.0-...-f7dfad8 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2024 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NORMAL  = ButtonState(0)
	HOVER   = ButtonState(1)
	PRESSED = ButtonState(2)
)
View Source
const (
	TITLE            State = 0
	PAUSED           State = 1
	GAME             State = 2
	GAME_OVER        State = 3
	HIGH_SCORE_INPUT State = 4
	HIGH_SCORES      State = 5

	TOTAL_PLATFORMS             = 1280 / 64
	GAME_OVER_FONT_SIZE float32 = 100.
	GAME_FONT_SIZE      float32 = GAME_OVER_FONT_SIZE / 2.
	ONE_UP              uint32  = 1000
	PLAYER_HIT_MAX      uint32  = 10
	MAX_POINTS          uint32  = 999999999
)
View Source
const HIGHEST_SCORE = 9999999999

Variables

View Source
var MkAssetDir func(string) string = MkDir(assetDir)

Functions

func CellFrom

func CellFrom(x float32, cellSize float32, maxCells int) int

func Center

func Center(dimensions WindowDimens) (x float32, y float32)

func CollideWithSides

func CollideWithSides(r1 rl.Rectangle, r2 rl.Rectangle) string

func DecodeInto

func DecodeInto[T any](filePath string, source T) (T, error)

func DrawHUD

func DrawHUD(textureAtlas TextureAtlas, windowDimens WindowDimens, lives uint32, points uint32)

func DrawPlatforms

func DrawPlatforms(textureAtlas TextureAtlas, windowDimens WindowDimens, textureSize float32, hitBoxes [20]HitBox)

func DrawPlayer

func DrawPlayer(player Player)

func DrawTextInput

func DrawTextInput(input TextInput)

func ElasticEaseOut

func ElasticEaseOut(time float32, begin float32, change float32, duration float32) float32

func ExitGame

func ExitGame(game *GameState) bool

func HighestScore

func HighestScore(highScores [5]PlayerScore, newScore PlayerScore) int

func InSine

func InSine(time float32, begin float32, change float32, duration float32) float32

func MaxDamage

func MaxDamage(damage DamageCounter) bool

func MkDir

func MkDir(rootDirectory string) func(string) string

func NextFrame

func NextFrame(animation LinearFrameAnimation) uint32

func PlayerBoundingBox

func PlayerBoundingBox(player *Player) rl.Rectangle

func RandRange

func RandRange(min int, max int) int

func ResetGameState

func ResetGameState(game *GameState)

func RunGame

func RunGame(game *GameState, delta float32)

func UpdateSpawner

func UpdateSpawner(spawner *Spawner, mover func(*Item, float32) bool, delta float32)

Types

type Boundaries

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

type Button

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

func NewButton

func NewButton(onClick func(state *GameState), position rl.Vector2) Button

type ButtonGroup

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

type ButtonState

type ButtonState uint8

type DamageCounter

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

func DamageCalc

func DamageCalc(damage DamageCounter, damageStep float32) DamageCounter

func NewDamageCounter

func NewDamageCounter(duration float32) DamageCounter

type Encoder

type Encoder[T any] struct {
	// contains filtered or unexported fields
}

func NewEncoder

func NewEncoder[T any](filePath string) (Encoder[T], error)

func (*Encoder[T]) Close

func (e *Encoder[T]) Close() error

func (*Encoder[T]) Encode

func (e *Encoder[T]) Encode(source T) error

type GameState

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

func NewGameState

func NewGameState(windowDimens [2]float32) GameState

func (*GameState) Release

func (state *GameState) Release()

type HitBox

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

type Item

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

type LinearFrameAnimation

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

func NewAnimation

func NewAnimation(duration float32, loops bool, frames uint32) LinearFrameAnimation

func UpdateAnimation

func UpdateAnimation(animation LinearFrameAnimation, dt float32) LinearFrameAnimation

type Physics

type Physics[T any] struct {
	// contains filtered or unexported fields
}

type Player

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

func NewPlayer

func NewPlayer(spriteSheetPath string, startPosition rl.Vector2, ground float32, playerSize float32) Player

func UpdatePlayer

func UpdatePlayer(player Player, delta float32) Player

type PlayerScore

type PlayerScore struct {
	PlayerName string `json:"player"`
	Score      uint32 `json:"score"`
}

type ScoreBoard

type ScoreBoard struct {
	FirstPosted bool           `json:"firstPosted"`
	Scores      [5]PlayerScore `json:"scores"`
}

type Spawner

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

func NewSpawner

func NewSpawner(duration float32, gravity float32, idPoolSize int, spawnLimit int, spawnBoundaries Boundaries) Spawner

type State

type State uint32

type TextInput

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

func NewTextInput

func NewTextInput(fontSize float32, limit uint32, start rl.Vector2, textColor rl.Color) TextInput

func UpdateTextInput

func UpdateTextInput(input TextInput) TextInput

type TextureAtlas

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

func NewTextureAtlas

func NewTextureAtlas(windowSize [2]float32) TextureAtlas

func (*TextureAtlas) Release

func (ta *TextureAtlas) Release()

type TextureSheets

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

type Timer

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

func NewTimer

func NewTimer(duration float32, loops bool) Timer

func Tick

func Tick(timer Timer, dt float32) Timer

type WindowDimens

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

Jump to

Keyboard shortcuts

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