snake

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Snake

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

func NewSnake

func NewSnake(tailMove []TailMove, pos, dir [2]float32, len int) *Snake

func (*Snake) Draw

func (s *Snake) Draw(screen *ebiten.Image)

func (*Snake) GetLength

func (s *Snake) GetLength() int

func (*Snake) GetMode

func (s *Snake) GetMode() SnakeMode

func (*Snake) GetStatus

func (s *Snake) GetStatus() TailStatus

func (*Snake) Move

func (s *Snake) Move()

func (*Snake) SetDirection

func (s *Snake) SetDirection(dir [2]float32)

func (*Snake) SetMode

func (s *Snake) SetMode(mode SnakeMode)

type SnakeMode

type SnakeMode bool
const (
	Pause SnakeMode = false
	Play  SnakeMode = true
)

type TailMove

type TailMove func(length *[][2]float32, headIndex int) (status TailStatus)

type TailStatus

type TailStatus bool
const (
	Dead TailStatus = false
	Live TailStatus = true
)

Jump to

Keyboard shortcuts

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