Game

package
v0.0.0-...-b5f20da Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2020 License: Apache-2.0, MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SubImageScale = 2
	FPS           = 30
)
View Source
const (
	P_SnkH = Ptype(0)
	P_SnkB = Ptype(1)
	P_SnkT = Ptype(2)
	P_Apl  = Ptype(3)
	P_Itm  = Ptype(4)
	P_Wall = Ptype(5)
)
View Source
const (
	ALIVE   = PlayerState(0)
	GHOST   = PlayerState(1)
	WAITING = PlayerState(2)
)
View Source
const MaxScoreTiles = 18

Variables

View Source
var (
	SnakeProGame   *SnakePro
	SnakeProInGame *InGame

	//Loaded Parameter Map
	Ps, IMGPOSITIONS *Utilities.Params

	//Screen attributes
	XRes, YRes     float64
	XTiles, YTiles float64
	MapToScreen    *map[Utilities.Point]Utilities.Point

	//Loading Screen Intro
	Loading_Intro *Utilities.ImageObj

	//Player attributes
	PlayerNum, PlayerStartLenght  int
	TileWidth, TileHeight         float64
	PlayerSpeed, ControllerThresh float64
	ControllerIds                 []int
	SnakeColors                   = []color.RGBA{{0, 0, 255, 255}, {255, 0, 60, 255}, {255, 255, 0, 255}, {239, 49, 165, 255}}

	//World attributes
	BeginItems, BeginApples, ItemSpawnPeriod, AppleNutrition uint
	PlayerAliveAloneFrames                                   int
	RottenAppleTime                                          float64

	//Stats
	RuntimeStatistics *RuntimeStats

	//Menu
	Exit_X, Exit_Y, Play_X, Play_Y, Con_X, Con_Y, HOF_X, HOF_Y float64
	PLN_XPOS, PLN_YPOS, PLN_WIDTH, PLN_HEIGHT                  float64
	Win_Head_Pos_X, Win_Head_Rot, Win_Head_S                   float64

	//Sounds
	SoundEffects map[string]*SoundEffect

	//Items
	LaserLength, BotLength                                                                                int
	ReviveImmortalTime, LaserTime, BombTime, BotSpeed, SpeedLength, SpeedStrength, FartTime, FartStrength float64
	BombLength, BombRadius, FartRadius                                                                    int
)
View Source
var (
	AL_PL__N_APL   = COLLISION(1)
	AL_PL__SELF    = COLLISION(2)
	AL_PL__AL_PL   = COLLISION(3)
	AL_PL__WALL    = COLLISION(4)
	AL_PL__ANY_ITM = COLLISION(5)

	GH_PL__N_APL   = COLLISION(7)
	GH_PL__ANY_ITM = COLLISION(8)
	GH_PL__WALL    = COLLISION(9)

	//true if victim
	VICTORY = COLLISION(10)
	SKILL   = COLLISION(11)
	LASER   = COLLISION(12)
	BOMB    = COLLISION(13)
	BOT     = COLLISION(14)
	FART    = COLLISION(15)
)
View Source
var (
	ControllSettings = []string{"Left", "Right", "Up", "Down", "Item"}
	SettingControll  int
	ChangingConID    int
	SettingNameID    int
	NEWNAMEFORID     string
	PLAYPLAYPLAY     bool
)
View Source
var (

	//HeadScale float64
	//HeadPos []*Point
	PokalScale float64
	PokalPos   []*Point
)
View Source
var (
	AppleImg, AppleImg_Rotten *Utilities.ImageObj
)
View Source
var (
	Bomb_Item_Image, Bomb_Item_Rotten_Image, Bomb_Item_Image_Corner, Bomb_Obj_Image_Radius, Bomb_Obj_Image *Utilities.ImageObj
)
View Source
var (
	Bot_Item_Image, Bot_Item_Rotten_Image, Bot_Item_Image_Corner, Bot_Obj_Image_H, Bot_Obj_Image_B *Utilities.ImageObj
)
View Source
var CornerPoints []*Utilities.Point
View Source
var (
	Fart_Item_Image, Fart_Item_Rotten_Image, Fart_Obj_Image, Fart_Obj_Rotten_Image, Fart_Item_Image_Corner *Utilities.ImageObj
)
View Source
var (
	ITEMNAME_Item_Image, ITEMNAME_Item_Image_Corner *Utilities.ImageObj
)
View Source
var KeyBackspaceState bool
View Source
var (
	Laser_Item_Image, Laser_Item_Rotten_Image, Laser_Item_Image_Corner, Laser_Obj_Image, Laser_Smoke_Obj_Image *Utilities.ImageObj
)
View Source
var LoadingPoints []*Utilities.Point
View Source
var LoadingSnakes []*Snake
View Source
var (
	PlayerSnakeBodies [][][]*Utilities.ImageObj
)
View Source
var (
	Revive_Item_Image, Revive_Item_Image_Corner *Utilities.ImageObj
)
View Source
var (
	Speed_Item_Image, Speed_Item_Image_Corner, Speed_Item_Rotten_Image *Utilities.ImageObj
)
View Source
var UpButtonsTime, UpListenerTime []int

Functions

func DrawPieceToScreen

func DrawPieceToScreen(ImageObj *Utilities.ImageObj, screen *ebiten.Image, pnt *Utilities.Point, mapper *map[Utilities.Point]Utilities.Point)

func EXITGAME

func EXITGAME()

func GetBestOfStatistic

func GetBestOfStatistic(g *InGame, category string) []int

func GetItemPos

func GetItemPos(ID int) (pnt *Utilities.Point)

func GetLineOfPoints

func GetLineOfPoints(pnt1, pnt2 *Utilities.Point) []*Utilities.Point

func GetPlayerStats

func GetPlayerStats(g *InGame, category string) []float64

func GetPlayerTiles

func GetPlayerTiles(ID int) [][]*Utilities.ImageObj

func GetPolynomOfPoints

func GetPolynomOfPoints(pnts ...*Utilities.Point) []*Utilities.Point

func GetSnakeTilesFromPlayerSnakeBodies

func GetSnakeTilesFromPlayerSnakeBodies(ID int) ([]*Utilities.ImageObj, []*Utilities.ImageObj, []*Utilities.ImageObj, []*Utilities.ImageObj, []*Utilities.ImageObj)

func HOFClick

func HOFClick(b *Utilities.Button)

func InitAppleImgs

func InitAppleImgs()

func InitSounds

func InitSounds()

func LoadStatistics

func LoadStatistics(path string, obj *Statistics) error

func MinuxXSqurdPOne

func MinuxXSqurdPOne(x float64) float64

func OnControllerClick

func OnControllerClick(b *Utilities.Button)

func OnExitClick

func OnExitClick(b *Utilities.Button)

func OnPlayNameLClick

func OnPlayNameLClick(b *Utilities.Button)

func OnPlayNameRClick

func OnPlayNameRClick(b *Utilities.Button)

func OnPokalClick

func OnPokalClick(b *Utilities.Button)

func PlayClick

func PlayClick(b *Utilities.Button)

func SaveStruct

func SaveStruct(path string, obj interface{})

func Start

func Start()

func StartGame

func StartGame(game ebiten.Game, name string, icons []image.Image)

Types

type Apple

type Apple struct {
	X, Y           int
	NutritionValue int
	Eaten          bool
	Pnt            *Utilities.Point
}

func GetRandomApple

func GetRandomApple(W, H int) *Apple

func (*Apple) Draw

func (a *Apple) Draw(screen *ebiten.Image, PntToScrn *map[Utilities.Point]Utilities.Point)

func (*Apple) OnCollision

func (a *Apple) OnCollision(ownTile, collTile Ptype, collPcs interface{})

type AppleTimer

type AppleTimer struct {
	Timer int
	Apple *Apple
}

func (*AppleTimer) Draw

func (o *AppleTimer) Draw(screen *ebiten.Image, mapper *map[Utilities.Point]Utilities.Point)

func (*AppleTimer) Exists

func (o *AppleTimer) Exists() bool

func (*AppleTimer) Update

func (o *AppleTimer) Update(g *InGame)

type Bomb

type Bomb struct {
	Position *Utilities.Point
	IsRotten bool
}

func (*Bomb) Draw

func (s *Bomb) Draw(screen *ebiten.Image, mapper *map[Utilities.Point]Utilities.Point)

func (*Bomb) DrawCorner

func (s *Bomb) DrawCorner(screen *ebiten.Image, pnt *Utilities.Point)

func (*Bomb) OnCollision

func (s *Bomb) OnCollision(ownTile, collTile Ptype, collPcs interface{})

func (*Bomb) Pos

func (s *Bomb) Pos() *Utilities.Point

func (*Bomb) Use

func (s *Bomb) Use(p *Player, g *InGame)

type BombFactory

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

func (*BombFactory) GetProbability

func (f *BombFactory) GetProbability() float64

func (*BombFactory) GetRandomItemInBounds

func (f *BombFactory) GetRandomItemInBounds(W, H int) Item

func (*BombFactory) Init

func (f *BombFactory) Init()

type BombObj

type BombObj struct {
	Owner    *Player
	Timer    int
	Position *Utilities.Point
	// contains filtered or unexported fields
}

func (*BombObj) Draw

func (o *BombObj) Draw(screen *ebiten.Image, mapper *map[Utilities.Point]Utilities.Point)

func (*BombObj) Exists

func (o *BombObj) Exists() bool

func (*BombObj) Explode

func (o *BombObj) Explode(g *InGame)

func (*BombObj) Update

func (o *BombObj) Update(g *InGame)

type Bot

type Bot struct {
	Position *Utilities.Point
	IsRotten bool
}

func (*Bot) Draw

func (s *Bot) Draw(screen *ebiten.Image, mapper *map[Utilities.Point]Utilities.Point)

func (*Bot) DrawCorner

func (s *Bot) DrawCorner(screen *ebiten.Image, pnt *Utilities.Point)

func (*Bot) OnCollision

func (s *Bot) OnCollision(ownTile, collTile Ptype, collPcs interface{})

func (*Bot) Pos

func (s *Bot) Pos() *Utilities.Point

func (*Bot) Use

func (s *Bot) Use(p *Player, g *InGame)

type BotFactory

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

func (*BotFactory) GetProbability

func (f *BotFactory) GetProbability() float64

func (*BotFactory) GetRandomItemInBounds

func (f *BotFactory) GetRandomItemInBounds(W, H int) Item

func (*BotFactory) Init

func (f *BotFactory) Init()

type BotSnake

type BotSnake struct {
	Snake
	Owner    *Player
	IsRotten bool
	Timer    int
}

func (*BotSnake) Draw

func (o *BotSnake) Draw(screen *ebiten.Image, mapper *map[Utilities.Point]Utilities.Point)

func (*BotSnake) Exists

func (o *BotSnake) Exists() bool

func (*BotSnake) GetClosestPlayer

func (o *BotSnake) GetClosestPlayer(g *InGame) *Player

func (*BotSnake) GetNextDir

func (o *BotSnake) GetNextDir(g *InGame) *Direction

func (*BotSnake) Init

func (o *BotSnake) Init(p *Player, g *InGame)

func (*BotSnake) Update

func (o *BotSnake) Update(g *InGame)

type COLLISION

type COLLISION int

type Direction

type Direction struct {
	Type int
}

func DetDirFrom2Ts

func DetDirFrom2Ts(p1, p2 *Utilities.Point) *Direction

func GetDirFromXYDif

func GetDirFromXYDif(xdif, ydif float64) *Direction

func GetRandomDir

func GetRandomDir() *Direction

func (*Direction) Copy

func (d *Direction) Copy() *Direction

func (*Direction) Equals

func (d *Direction) Equals(d2 *Direction) bool

func (*Direction) GetRotation

func (d *Direction) GetRotation() float64

func (*Direction) GetXYDif

func (d *Direction) GetXYDif() (float64, float64)

func (*Direction) Inverse

func (d *Direction) Inverse() *Direction

func (*Direction) IsInvers

func (d *Direction) IsInvers(d2 *Direction) bool

func (*Direction) IsLeft

func (d *Direction) IsLeft(d2 *Direction) bool

func (*Direction) IsRight

func (d *Direction) IsRight(d2 *Direction) bool

func (*Direction) Left

func (d *Direction) Left() *Direction

func (*Direction) Right

func (d *Direction) Right() *Direction

type Fart

type Fart struct {
	Position *Utilities.Point
	IsRotten bool
}

func (*Fart) Draw

func (s *Fart) Draw(screen *ebiten.Image, mapper *map[Utilities.Point]Utilities.Point)

func (*Fart) DrawCorner

func (s *Fart) DrawCorner(screen *ebiten.Image, pnt *Utilities.Point)

func (*Fart) OnCollision

func (s *Fart) OnCollision(ownTile, collTile Ptype, collPcs interface{})

func (*Fart) Pos

func (s *Fart) Pos() *Utilities.Point

func (*Fart) Use

func (s *Fart) Use(p *Player, g *InGame)

type FartFactory

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

func (*FartFactory) GetProbability

func (f *FartFactory) GetProbability() float64

func (*FartFactory) GetRandomItemInBounds

func (f *FartFactory) GetRandomItemInBounds(W, H int) Item

func (*FartFactory) Init

func (f *FartFactory) Init()

type FartObj

type FartObj struct {
	Owner    *Player
	Timer    int
	Position *Utilities.Point

	IsRotten bool
	// contains filtered or unexported fields
}

func (*FartObj) Draw

func (o *FartObj) Draw(screen *ebiten.Image, mapper *map[Utilities.Point]Utilities.Point)

func (*FartObj) Exists

func (o *FartObj) Exists() bool

func (*FartObj) Update

func (o *FartObj) Update(g *InGame)

type GameState

type GameState interface {
	Update(screen *ebiten.Image) error
	Draw(screen *ebiten.Image)
	Layout(outsideWidth, outsideHeight int) (int, int)
	Init(*SnakePro)
	Start()
}

type HallOfFame

type HallOfFame struct {
	Back *Utilities.ImageObj

	PokalBtns   []*Utilities.Button
	PokalSnakes [][]*Snake
	// contains filtered or unexported fields
}

func (*HallOfFame) Draw

func (h *HallOfFame) Draw(screen *ebiten.Image)

func (*HallOfFame) Init

func (h *HallOfFame) Init(g *SnakePro)

*

func DisplayHeadAtPokal(idx int, Head *Utilities.ImageObj, screen *ebiten.Image) {
	Head.X, Head.Y = HeadPos[idx].X, HeadPos[idx].Y
	Head.W, Head.H = HeadScale,HeadScale
	Head.Angle = 0
	Head.DrawImageObj(screen)
}

*

func (*HallOfFame) Layout

func (h *HallOfFame) Layout(outsideWidth, outsideHeight int) (int, int)

func (*HallOfFame) Start

func (h *HallOfFame) Start()

func (*HallOfFame) Update

func (h *HallOfFame) Update(screen *ebiten.Image) error

type ITEMNAME

type ITEMNAME struct {
	Position *Utilities.Point
}

func (*ITEMNAME) Draw

func (s *ITEMNAME) Draw(screen *ebiten.Image, mapper *map[Utilities.Point]Utilities.Point)

func (*ITEMNAME) DrawCorner

func (s *ITEMNAME) DrawCorner(screen *ebiten.Image, pnt *Utilities.Point)

func (*ITEMNAME) OnCollision

func (s *ITEMNAME) OnCollision(ownTile, collTile Ptype, collPcs interface{})

func (*ITEMNAME) Pos

func (s *ITEMNAME) Pos() *Utilities.Point

func (*ITEMNAME) Use

func (s *ITEMNAME) Use(p *Player, g *InGame)

type ITEMNAMEFactory

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

func (*ITEMNAMEFactory) GetProbability

func (f *ITEMNAMEFactory) GetProbability() float64

func (*ITEMNAMEFactory) GetRandomItemInBounds

func (f *ITEMNAMEFactory) GetRandomItemInBounds(W, H int) Item

func (*ITEMNAMEFactory) Init

func (f *ITEMNAMEFactory) Init()

type InGame

type InGame struct {
	World *World

	Pls []*Player

	ReturnTime int
	// contains filtered or unexported fields
}

func (*InGame) CheckIfAllDead

func (g *InGame) CheckIfAllDead()

func (*InGame) Draw

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

func (*InGame) Init

func (g *InGame) Init(parentG *SnakePro)

func (*InGame) Layout

func (g *InGame) Layout(outsideWidth, outsideHeight int) (int, int)

func (*InGame) Start

func (g *InGame) Start()

func (*InGame) Update

func (g *InGame) Update(screen *ebiten.Image) error

type Item

type Item interface {
	Use(*Player, *InGame)
	Pos() *Utilities.Point
	OnCollision(ownTile, collTile Ptype, collPcs interface{})
	Draw(*ebiten.Image, *map[Utilities.Point]Utilities.Point)
	DrawCorner(*ebiten.Image, *Utilities.Point)
}

type ItemFactory

type ItemFactory interface {
	GetRandomItemInBounds(W, H int) Item
	GetProbability() float64
}

type Laser

type Laser struct {
	Position *Utilities.Point
	IsRotten bool
}

func (*Laser) Draw

func (s *Laser) Draw(screen *ebiten.Image, mapper *map[Utilities.Point]Utilities.Point)

func (*Laser) DrawCorner

func (s *Laser) DrawCorner(screen *ebiten.Image, pnt *Utilities.Point)

func (*Laser) OnCollision

func (s *Laser) OnCollision(ownTile, collTile Ptype, collPcs interface{})

func (*Laser) Pos

func (s *Laser) Pos() *Utilities.Point

func (*Laser) Use

func (s *Laser) Use(p *Player, g *InGame)

type LaserFactory

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

func (*LaserFactory) GetProbability

func (f *LaserFactory) GetProbability() float64

func (*LaserFactory) GetRandomItemInBounds

func (f *LaserFactory) GetRandomItemInBounds(W, H int) Item

func (*LaserFactory) Init

func (f *LaserFactory) Init()

type LaserObj

type LaserObj struct {
	Owner           *Player
	Points          *Utilities.SnakeTiles
	Timer, FullTime int
	Rotation        *Direction
	// contains filtered or unexported fields
}

func (*LaserObj) Draw

func (o *LaserObj) Draw(screen *ebiten.Image, mapper *map[Utilities.Point]Utilities.Point)

func (*LaserObj) Exists

func (o *LaserObj) Exists() bool

func (*LaserObj) Update

func (o *LaserObj) Update(g *InGame)

type LastPlayerNames

type LastPlayerNames struct {
	L1, L2, L3, L4 string
}

func LoadLastPlayerNames

func LoadLastPlayerNames(path string) (*LastPlayerNames, error)

func (*LastPlayerNames) Get

func (l *LastPlayerNames) Get(i int) string

func (*LastPlayerNames) Save

func (l *LastPlayerNames) Save(path string)

func (*LastPlayerNames) Set

func (l *LastPlayerNames) Set(i int, name string)
type Menu struct {
	Buttons, NameBtns []*Utilities.Button

	BackGroundImg *Utilities.ImageObj

	PlayerScores []*Snake

	ChangingCons []int
	// contains filtered or unexported fields
}
func (g *Menu) Draw(screen *ebiten.Image)
func (g *Menu) Init(parentG *SnakePro)
func (g *Menu) Layout(outsideWidth, outsideHeight int) (int, int)
func (g *Menu) SetController()
func (g *Menu) Start()
func (g *Menu) Update(screen *ebiten.Image) error
func (g *Menu) UpdateDrawedPlayerName(i int)

type Piece

type Piece interface {
	Ptype() Ptype
	GetImg() *Utilities.ImageObj
}

type Player

type Player struct {
	ID, ConID   int
	CurrentItem Item
	ItemPos     *Utilities.Point
	Statistic   *PlayerStats
	// contains filtered or unexported fields
}

func (*Player) Draw

func (p *Player) Draw(screen *ebiten.Image, PntToScrn *map[Utilities.Point]Utilities.Point)

func (*Player) EatFood

func (p *Player) EatFood(NutritionValue int)

func (*Player) GetAllPieces

func (p *Player) GetAllPieces() ([]Piece, []*Utilities.Point)

func (*Player) GetAllPoints

func (p *Player) GetAllPoints() []*Utilities.Point

func (*Player) GetCurrDir

func (p *Player) GetCurrDir() *Direction

func (*Player) GetHead

func (p *Player) GetHead() *Utilities.Point

func (*Player) GetNextDir

func (p *Player) GetNextDir() *Direction

func (*Player) GetScore

func (p *Player) GetScore() int

func (*Player) GetSpeed

func (p *Player) GetSpeed() float64

func (*Player) GetState

func (p *Player) GetState() PlayerState

func (*Player) GetTail

func (p *Player) GetTail() *Utilities.Point

func (*Player) GetTiles

func (p *Player) GetTiles() *Utilities.SnakeTiles

func (*Player) Init

func (p *Player) Init(g *InGame, ID int, speed float64)

func (*Player) OnCollision

func (p *Player) OnCollision(coll COLLISION, kill, dead int)

func (*Player) Reset

func (p *Player) Reset(ID, conID int, speed float64, state PlayerState)

func (*Player) SetCurrDir

func (p *Player) SetCurrDir(dir *Direction)

func (*Player) SetDead

func (p *Player) SetDead(frame int)

func (*Player) SetNextDir

func (p *Player) SetNextDir(dir *Direction)

func (*Player) SetScore

func (p *Player) SetScore(score int)

func (*Player) SetSpeed

func (p *Player) SetSpeed(speed float64)

func (*Player) SetState

func (p *Player) SetState(state PlayerState)

func (*Player) SetUndestroyable

func (p *Player) SetUndestroyable(t int)

func (*Player) Update

func (p *Player) Update(frame int)

type PlayerButtonEventListener

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

func (*PlayerButtonEventListener) GetButton

func (l *PlayerButtonEventListener) GetButton() int

func (*PlayerButtonEventListener) OnButtonDown

func (l *PlayerButtonEventListener) OnButtonDown()

func (*PlayerButtonEventListener) OnButtonUp

func (l *PlayerButtonEventListener) OnButtonUp()

type PlayerDirectionEventListener

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

func (*PlayerDirectionEventListener) GetAxis

func (l *PlayerDirectionEventListener) GetAxis() (int, int, int, int)

func (*PlayerDirectionEventListener) OnDirectionEvent

func (l *PlayerDirectionEventListener) OnDirectionEvent(xdif, ydif float64)

type PlayerScoreAndID

type PlayerScoreAndID struct {
	ID int
	// contains filtered or unexported fields
}

func GetStatisticsList

func GetStatisticsList(g *InGame, category string) []PlayerScoreAndID

type PlayerState

type PlayerState int

type PlayerStats

type PlayerStats struct {
	Statistics
	// contains filtered or unexported fields
}

func GetNewPlayerStatistic

func GetNewPlayerStatistic(name string, strs []string) (s *PlayerStats)

func (*PlayerStats) Load

func (s *PlayerStats) Load() error

func (*PlayerStats) Name

func (s *PlayerStats) Name() string

func (*PlayerStats) Save

func (s *PlayerStats) Save()

func (*PlayerStats) SetName

func (s *PlayerStats) SetName(name string)

type Point

type Point struct {
	X, Y float64
}

type Ptype

type Ptype int

type Revive

type Revive struct {
	Position *Utilities.Point
}

func (*Revive) Draw

func (s *Revive) Draw(screen *ebiten.Image, mapper *map[Utilities.Point]Utilities.Point)

func (*Revive) DrawCorner

func (s *Revive) DrawCorner(screen *ebiten.Image, pnt *Utilities.Point)

func (*Revive) OnCollision

func (s *Revive) OnCollision(ownTile, collTile Ptype, collPcs interface{})

func (*Revive) Pos

func (s *Revive) Pos() *Utilities.Point

func (*Revive) Use

func (s *Revive) Use(p *Player, g *InGame)

type ReviveFactory

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

func (*ReviveFactory) GetProbability

func (f *ReviveFactory) GetProbability() float64

func (*ReviveFactory) GetRandomItemInBounds

func (f *ReviveFactory) GetRandomItemInBounds(W, H int) Item

func (*ReviveFactory) Init

func (f *ReviveFactory) Init()

type ReviveObj

type ReviveObj struct {
	Position                *Utilities.Point
	RemainingTime, FullTime int
	// contains filtered or unexported fields
}

func (*ReviveObj) Draw

func (o *ReviveObj) Draw(screen *ebiten.Image, mapper *map[Utilities.Point]Utilities.Point)

func (*ReviveObj) Exists

func (o *ReviveObj) Exists() bool

func (*ReviveObj) Update

func (o *ReviveObj) Update(g *InGame)

type RuntimeStats

type RuntimeStats struct {
	Statistics
}

type Snake

type Snake struct {
	Score int

	SnkH, SnkB, SnkT, SnkR, SnkL []*Utilities.ImageObj
	// contains filtered or unexported fields
}

func CreateSnake

func CreateSnake(g *InGame, SnkH, SnkB, SnkT, SnkR, SnkL []*Utilities.ImageObj) (s *Snake)

func GetSnakeOfPolygon

func GetSnakeOfPolygon(ID int, pnts ...*Utilities.Point) *Snake

func GetSnakeOfType

func GetSnakeOfType(playerID int) *Snake

func GetWinnerSnakes

func GetWinnerSnakes(first, second, third, x, y int) []*Snake

func (*Snake) Draw

func (s *Snake) Draw(screen *ebiten.Image, PntToScrn *map[Utilities.Point]Utilities.Point)

func (*Snake) EatFood

func (s *Snake) EatFood(NutritionValue int)

func (*Snake) GetAllPieces

func (s *Snake) GetAllPieces() ([]Piece, []*Utilities.Point)

func (*Snake) GetAllPoints

func (s *Snake) GetAllPoints() []*Utilities.Point

func (*Snake) GetHead

func (s *Snake) GetHead() *Utilities.Point

func (*Snake) Reset

func (s *Snake) Reset(speed float64, state, X, Y, lenght int, dir *Direction)

func (*Snake) Update

func (s *Snake) Update(frame int)

func (*Snake) UpdateCurrDir

func (s *Snake) UpdateCurrDir()

func (*Snake) UpdateSnakeHead

func (s *Snake) UpdateSnakeHead()

func (*Snake) UpdateSnakeTail

func (s *Snake) UpdateSnakeTail()

type SnakePiece

type SnakePiece struct {
	Type Ptype
	// contains filtered or unexported fields
}

func (*SnakePiece) GetImg

func (s *SnakePiece) GetImg() *Utilities.ImageObj

func (*SnakePiece) Ptype

func (s *SnakePiece) Ptype() Ptype

type SnakePro

type SnakePro struct {
	CurrentState int

	States []GameState

	Cons *[]*Utilities.Controller

	Toasts []*Toast

	XRes, YRes             float64
	XTiles, YTiles         float64
	XTileWidth, YTileWidth float64
	// contains filtered or unexported fields
}

func (*SnakePro) DrawToScreen

func (g *SnakePro) DrawToScreen(screen *ebiten.Image)

func (*SnakePro) DrawToasts

func (g *SnakePro) DrawToasts(screen *ebiten.Image)

func (*SnakePro) Init

func (g *SnakePro) Init()

func (*SnakePro) InitBeginning

func (g *SnakePro) InitBeginning(screen *ebiten.Image)

func (*SnakePro) Layout

func (g *SnakePro) Layout(outsideWidth, outsideHeight int) (int, int)

func (g *SnakePro) Draw(screen *ebiten.Image) {}

func (*SnakePro) MakeToast

func (g *SnakePro) MakeToast(str string)

func (*SnakePro) RemoveToasts

func (g *SnakePro) RemoveToasts()

func (*SnakePro) SaveCons

func (g *SnakePro) SaveCons(ids []int)

func (*SnakePro) Update

func (g *SnakePro) Update(screen *ebiten.Image) error

func (*SnakePro) UpdateToasts

func (g *SnakePro) UpdateToasts()

type SoundEffect

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

func LoadSoundEffect

func LoadSoundEffect(folder string) (s *SoundEffect)

func (*SoundEffect) PR

func (s *SoundEffect) PR()

type Speed

type Speed struct {
	Position *Utilities.Point
	IsRotten bool
}

func (*Speed) Draw

func (s *Speed) Draw(screen *ebiten.Image, mapper *map[Utilities.Point]Utilities.Point)

func (*Speed) DrawCorner

func (s *Speed) DrawCorner(screen *ebiten.Image, pnt *Utilities.Point)

func (*Speed) OnCollision

func (s *Speed) OnCollision(ownTile, collTile Ptype, collPcs interface{})

func (*Speed) Pos

func (s *Speed) Pos() *Utilities.Point

func (*Speed) Use

func (s *Speed) Use(p *Player, g *InGame)

type SpeedFactory

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

func (*SpeedFactory) GetProbability

func (f *SpeedFactory) GetProbability() float64

func (*SpeedFactory) GetRandomItemInBounds

func (f *SpeedFactory) GetRandomItemInBounds(W, H int) Item

func (*SpeedFactory) Init

func (f *SpeedFactory) Init()

type SpeedObj

type SpeedObj struct {
	Owner     *Player
	Timer     int
	IsRotten  bool
	RottenDec int
	// contains filtered or unexported fields
}

func (*SpeedObj) Draw

func (o *SpeedObj) Draw(screen *ebiten.Image, mapper *map[Utilities.Point]Utilities.Point)

func (*SpeedObj) Exists

func (o *SpeedObj) Exists() bool

func (*SpeedObj) Update

func (o *SpeedObj) Update(g *InGame)

type StaticObj

type StaticObj interface {
	Update(*InGame)
	Draw(*ebiten.Image, *map[Utilities.Point]Utilities.Point)
	Exists() bool
}

type Statistics

type Statistics struct {
	Header []string
	Stats  [][]string
	Head   map[string]int
}

func (*Statistics) AddHead

func (r *Statistics) AddHead(head string, val int)

func (*Statistics) Append

func (r *Statistics) Append()

func (*Statistics) GetHead

func (r *Statistics) GetHead(head string) int

func (*Statistics) Init

func (r *Statistics) Init(strs []string)

func (*Statistics) Print

func (r *Statistics) Print() string

func (*Statistics) ResetHeader

func (r *Statistics) ResetHeader()

func (*Statistics) Set

func (r *Statistics) Set()

func (*Statistics) SetHead

func (r *Statistics) SetHead(head string, val int)

func (*Statistics) WriteToCSV

func (r *Statistics) WriteToCSV(path string)

type Teststruct

type Teststruct struct {
	Fett      map[string]int
	Fettheit2 [][]string
}

type Teststruct2

type Teststruct2 struct {
	Teststruct
	Fettheit [][]string
}

type Toast

type Toast struct {
	RemainingTime int
	// contains filtered or unexported fields
}

func GetStandardToastShort

func GetStandardToastShort(str string) *Toast

func GetToast

func GetToast(str string, time float64, textCol, backCol color.RGBA, X, Y, W, H float64) *Toast

func GetToastUp

func GetToastUp(str string, time float64, textCol, backCol color.RGBA) *Toast

func (*Toast) Draw

func (t *Toast) Draw(screen *ebiten.Image, idx int)

type World

type World struct {
	ItemFactories []ItemFactory
	Itms          []Item
	SObjs         []StaticObj
	Pls           []*Player
	Apls          []*Apple
	// contains filtered or unexported fields
}

func (*World) CheckAL_PL__AL_PL

func (w *World) CheckAL_PL__AL_PL(pl *Player, i int)

func (*World) CheckAL_PL__ANY_ITM

func (w *World) CheckAL_PL__ANY_ITM(pl *Player)

func (*World) CheckAL_PL__N_APL

func (w *World) CheckAL_PL__N_APL(pl *Player)

func (*World) CheckAL_PL__SELF

func (w *World) CheckAL_PL__SELF(pl *Player)

func (*World) CheckAL_PL__WALL

func (w *World) CheckAL_PL__WALL(pl *Player)

func (*World) CheckCollision

func (w *World) CheckCollision()

func (*World) CheckCollisionPlayer

func (w *World) CheckCollisionPlayer(pl *Player)

func (*World) CheckGH_PL__ANY_ITM

func (w *World) CheckGH_PL__ANY_ITM(pl *Player)

func (*World) CheckGH_PL__N_APL

func (w *World) CheckGH_PL__N_APL(pl *Player)

func (*World) CheckGH_PL__WALL

func (w *World) CheckGH_PL__WALL(pl *Player)

func (*World) Draw

func (w *World) Draw(screen *ebiten.Image)

func (*World) InitBeginning

func (w *World) InitBeginning()

func (*World) RemoveApple

func (w *World) RemoveApple(i int)

func (*World) RemoveAppleObj

func (w *World) RemoveAppleObj(a *Apple)

func (*World) RemoveItem

func (w *World) RemoveItem(i int)

func (*World) RemoveObjs

func (w *World) RemoveObjs(is []int)

func (*World) SpawnApple

func (w *World) SpawnApple()

func (*World) SpawnItem

func (w *World) SpawnItem()

func (*World) Start

func (w *World) Start(pls []*Player)

func (*World) Update

func (w *World) Update(frame int)

Jump to

Keyboard shortcuts

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