snake

package
v0.0.0-...-d12af05 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2022 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	MouthEnabled = false
)

Functions

This section is empty.

Types

type DirectionT

type DirectionT uint8
const (
	DirectionUp DirectionT = iota
	DirectionDown
	DirectionLeft
	DirectionRight
	DirectionTotal
)

func (DirectionT) IsVertical

func (d DirectionT) IsVertical() bool

type Snake

type Snake struct {
	Speed    float64
	UnitHead *Unit

	FoodEaten uint8
	// contains filtered or unexported fields
}

func NewSnake

func NewSnake(headCenter c.Vec64, initialLength uint16, speed float64, direction DirectionT, color *color.RGBA) *Snake

func NewSnakeRandDir

func NewSnakeRandDir(headCenter c.Vec64, initialLength uint16, speed float64, color *color.RGBA) *Snake

func NewSnakeRandDirLoc

func NewSnakeRandDirLoc(initialLength uint16, speed float64, color *color.RGBA) *Snake

func (*Snake) Draw

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

func (*Snake) Grow

func (s *Snake) Grow()

func (*Snake) LastDirection

func (s *Snake) LastDirection() DirectionT

func (*Snake) TurnTo

func (s *Snake) TurnTo(newTurn *Turn, isFromQueue bool)

func (*Snake) Update

func (s *Snake) Update(distToFood float32)

type Turn

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

func NewTurn

func NewTurn(directionFrom, directionTo DirectionT) *Turn

type Unit

type Unit struct {
	HeadCenter c.Vec64

	Direction       DirectionT
	CompCollision   c.TeleComp
	CompBody        c.TeleCompImage
	CompTriangDebug c.TeleCompTriang
	CompTriangHead  c.TeleCompTriang
	CompTriangTail  c.TeleCompTriang
	Next            *Unit
	// contains filtered or unexported fields
}

func NewUnit

func NewUnit(headCenter c.Vec64, length float64, direction DirectionT, color *color.RGBA) *Unit

func (*Unit) CollEnabled

func (u *Unit) CollEnabled() bool

Implement collidable interface ------------------------------

func (*Unit) CollisionRects

func (u *Unit) CollisionRects() []c.RectF32

func (*Unit) DrawDebugInfo

func (u *Unit) DrawDebugInfo(dst *ebiten.Image)

func (*Unit) SetColor

func (u *Unit) SetColor(clr *color.RGBA)

Jump to

Keyboard shortcuts

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