objects

package
v2.0.0-rc-2016+incompa... Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2016 License: BSD-2-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Apple

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

func CreateApple

func CreateApple(p GameProcessor, pg *playground.Playground,
) (*Apple, error)

CreateApple creates and locates new apple

func (*Apple) Dot

func (a *Apple) Dot(i uint16) *playground.Dot

Implementing playground.Object interface

func (*Apple) DotCount

func (*Apple) DotCount() uint16

Implementing playground.Object interface

func (*Apple) NutritionalValue

func (a *Apple) NutritionalValue(dot *playground.Dot) int8

Implementing logic.Food interface

func (*Apple) Pack

func (a *Apple) Pack() interface{}

Implementing Object interface

type Corpse

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

Snakes can eat corpses

func CreateCorpse

func CreateCorpse(p GameProcessor, pg *playground.Playground,
	cxt context.Context, dots playground.DotList) (*Corpse, error)

Corpses are created when a snake dies

func (*Corpse) Dot

func (c *Corpse) Dot(i uint16) *playground.Dot

Implementing playground.Object interface

func (*Corpse) DotCount

func (c *Corpse) DotCount() uint16

Implementing playground.Object interface

func (*Corpse) NutritionalValue

func (c *Corpse) NutritionalValue(dot *playground.Dot) int8

Implementing logic.Food interface

type GameProcessor

type GameProcessor interface {
	OccurredError(object interface{}, err error)
	OccurredCreating(object interface{})
	OccurredDeleting(object interface{})
	OccurredUpdating(object interface{})
}

objects use GameProcessor to notifying about its states

type Object

type Object interface {
	Pack() interface{}
}

Object interfaces

type Shifting

type Shifting interface {
	PackShifts() interface{}
}

Object interfaces

type Snake

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

Snake object

func CreateSnake

func CreateSnake(p GameProcessor, pg *playground.Playground,
	cxt context.Context) (*Snake, error)

CreateSnake creates new snake

func (*Snake) Command

func (s *Snake) Command(cmd string) error

Implementing logic.Controlled interface

func (*Snake) Die

func (s *Snake) Die()

Implementing logic.Living interface

func (*Snake) Dot

func (s *Snake) Dot(i uint16) *playground.Dot

Implementing playground.Object interface

func (*Snake) DotCount

func (s *Snake) DotCount() uint16

Implementing playground.Object interface

func (*Snake) Feed

func (s *Snake) Feed(f int8)

Implementing logic.Living interface

func (*Snake) Strength

func (s *Snake) Strength() float32

Implementing logic.Resistant interface

type Wall

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

func CreateLongWall

func CreateLongWall(p GameProcessor, pg *playground.Playground,
) (*Wall, error)

func CreateWall

func CreateWall(p GameProcessor, pg *playground.Playground,
	dots playground.DotList) (*Wall, error)

func (*Wall) Break

func (w *Wall) Break(dot *playground.Dot)

Implementing logic.Notalive interface

func (*Wall) Dot

func (w *Wall) Dot(i uint16) *playground.Dot

Implementing playground.Object interface

func (*Wall) DotCount

func (w *Wall) DotCount() uint16

Implementing playground.Object interface

func (*Wall) Strength

func (*Wall) Strength() float32

Implementing logic.Resistant interface

type Watermelon

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

func CreateWatermelon

func CreateWatermelon(p GameProcessor, pg *playground.Playground,
	cxt context.Context) (*Watermelon, error)

func (*Watermelon) Dot

func (w *Watermelon) Dot(i uint16) (dot *playground.Dot)

Implementing playground.Object interface

func (*Watermelon) DotCount

func (w *Watermelon) DotCount() (c uint16)

Implementing playground.Object interface

func (*Watermelon) NutritionalValue

func (w *Watermelon) NutritionalValue(dot *playground.Dot) int8

Implementing logic.Food interface

Jump to

Keyboard shortcuts

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