game

package
v0.0.0-...-3fd9c7e Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2017 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateRandomBerry

func GenerateRandomBerry(gameCFG *Config) pixel.Vec

GenerateRandomBerry generates a new berry in a random location

Types

type Config

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

Config is a struct used to define the configuration of the game

func NewGameConfig

func NewGameConfig(xSize float64, ySize float64, borderWeight float64, gridSize float64, winCFG pixelgl.WindowConfig) Config

NewGameConfig returns and initialised Game Configuration Struct

func (*Config) GetBorderWeight

func (cfg *Config) GetBorderWeight() float64

GetBorderWeight returns the weight in pixels of the border of the game area

func (*Config) GetGameAreaAsRec

func (cfg *Config) GetGameAreaAsRec() pixel.Rect

GetGameAreaAsRec returns the rectangle representing the game area in it's native coordinates

func (*Config) GetGameAreaAsVecs

func (cfg *Config) GetGameAreaAsVecs() (min pixel.Vec, max pixel.Vec)

GetGameAreaAsVecs returns the vectors representing the game area in it's native coordinates

func (*Config) GetGameAreaDims

func (cfg *Config) GetGameAreaDims() (x float64, y float64)

GetGameAreaDims returns the dimensions of the game area

func (*Config) GetGridMatrix

func (cfg *Config) GetGridMatrix() pixel.Matrix

GetGridMatrix returns the matrix for the game grid which is used to translate the snake coordinates onto the game area.

func (*Config) GetGridSize

func (cfg *Config) GetGridSize() float64

GetGridSize returns the pixel size of the game grid

func (*Config) GetWindowMatrix

func (cfg *Config) GetWindowMatrix() pixel.Matrix

GetWindowMatrix returns the matrix for the game area which is used to translate the game area coordinates onto the window.

Jump to

Keyboard shortcuts

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