game

package
v0.0.0-...-7288c90 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GameOver

func GameOver() tea.Msg

func MoveGhosts

func MoveGhosts() tea.Cmd

func MovePacman

func MovePacman() tea.Cmd

Types

type Game

type Game struct {
	Board  [31][28]int
	Score  int
	Pacman Pacman
	Ghosts [4]*Ghost
	Styles style.Styles
}

func InitialGameModel

func InitialGameModel() Game

func (Game) Init

func (m Game) Init() tea.Cmd

func (Game) Update

func (m Game) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (Game) View

func (m Game) View() string

type GameOverMsg

type GameOverMsg int

type Ghost

type Ghost struct {
	XPosition               int
	YPosition               int
	ViewCode                int
	IsCurrentPositionPellet bool
	Direction               int // 0: static, 1: up, 2: down, 3: left 4: right
}

type Pacman

type Pacman struct {
	XPosition int
	YPosition int
	Direction int // 0: static, 1: up, 2: down, 3: left 4: right
	Lives     int
}

type UpdateGhostsPositionMsg

type UpdateGhostsPositionMsg int

type UpdatePacmanPositionMsg

type UpdatePacmanPositionMsg int

Jump to

Keyboard shortcuts

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