snake

package
v0.0.0-...-e13810e Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ScreenWidth  = 420
	ScreenHeight = 600
)

Variables

View Source
var (
	ErrorOutOfBoard = errors.New("Snake is out of theBoard")
)

Functions

This section is empty.

Types

type Board

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

func NewBoard

func NewBoard(sizeX, sizeY int) *Board

func (*Board) Draw

func (b *Board) Draw(boardImage *ebiten.Image)

func (*Board) Size

func (b *Board) Size() (int, int)

func (*Board) Update

func (b *Board) Update() error

type Game

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

func NewGame

func NewGame(sizeX, sizeY int) *Game

func (*Game) Draw

func (g *Game) Draw(screen *ebiten.Image)

func (*Game) Layout

func (g *Game) Layout(outsideWidth, outsideHeight int) (screenWidth, screenHeight int)

func (*Game) Update

func (g *Game) Update() error

type Info

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

func NewInfo

func NewInfo(sizeX, sizeY int) *Info

func (*Info) Draw

func (i *Info) Draw(infoImage *ebiten.Image)

func (*Info) Size

func (i *Info) Size() (int, int)

func (*Info) Update

func (i *Info) Update() error

type Input

type Input struct {
}

func NewInput

func NewInput() *Input

func (*Input) Update

func (i *Input) Update()

type Layout

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

func NewLayout

func NewLayout(layoutSizeX, layoutSizeY int) *Layout

func (*Layout) Draw

func (l *Layout) Draw(screen *ebiten.Image)

func (*Layout) Update

func (l *Layout) Update() error

type Position

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

type Positions

type Positions []Position

type Snake

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

func NewSnake

func NewSnake(tiles Tiles) *Snake

func (*Snake) Move

func (s *Snake) Move(direction int)

type Tile

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

func NewTile

func NewTile(tileType TileType) *Tile

func (*Tile) Clone

func (t *Tile) Clone() *Tile

func (*Tile) Draw

func (t *Tile) Draw(tileImage *ebiten.Image)

func (*Tile) Empty

func (t *Tile) Empty()

func (*Tile) IsFood

func (t *Tile) IsFood() bool

func (*Tile) Snake

func (t *Tile) Snake()

type TileImages

type TileImages [][]*ebiten.Image

type TileType

type TileType int

type Tiles

type Tiles [][]*Tile

Jump to

Keyboard shortcuts

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