Documentation ¶
Index ¶
- Constants
- Variables
- func EncodeMovements(movements []MovementType) string
- func GetLastPackageName() string
- func InitLevel(world w.World, levelNum int)
- func LoadSave(world w.World)
- func Move(world w.World, movements ...MovementType)
- func NormalizeHighScores(t HighscoreTable)
- func SaveLevel(world w.World)
- func Undo(world w.World)
- func UpdateGameLayout(world w.World, gridLayout *GridLayout) (int, int)
- type EncodedSaveConfig
- type Game
- type GamePrefabs
- type GridLayout
- type Highscore
- type HighscoreTable
- type Level
- type MenuPrefabs
- type MovementType
- type PackageData
- type Prefabs
- type SaveConfig
- type StateEvent
- type Tile
Constants ¶
const ( // MoveUpAction is the action for moving up MoveUpAction = "MoveUp" // MoveUpFastAction is the action for moving up fast MoveUpFastAction = "MoveUpFast" // MoveDownAction is the action for moving down MoveDownAction = "MoveDown" // MoveDownFastAction is the action for moving down fast MoveDownFastAction = "MoveDownFast" // MoveLeftAction is the action for moving left MoveLeftAction = "MoveLeft" // MoveLeftFastAction is the action for moving left fast MoveLeftFastAction = "MoveLeftFast" // MoveRightAction is the action for moving right MoveRightAction = "MoveRight" // MoveRightFastAction is the action for moving right fast MoveRightFastAction = "MoveRightFast" // PreviousLevelAction is the action for switching to the previous level PreviousLevelAction = "PreviousLevel" // PreviousLevelFastAction is the action for switching fast to the previous level PreviousLevelFastAction = "PreviousLevelFast" // NextLevelAction is the action for switching to the next level NextLevelAction = "NextLevel" // NextLevelFastAction is the action for switching fast to the next level NextLevelFastAction = "NextLevelFast" // UndoAction is the action for undoing the last move UndoAction = "Undo" // UndoFastAction is the action for undoing the last move fast UndoFastAction = "UndoFast" // RestartAction is the action for restarting the level RestartAction = "Restart" // SaveAction is the action for saving the level SaveAction = "Save" // GoToLevelAction is the action for switching to a specific level GoToLevelAction = "GoToLevel" // NextStepSolutionAction is the action for playing the next solution step NextStepSolutionAction = "NextStepSolution" // NextStepSolutionFastAction is the action for playing the next solution step fast NextStepSolutionFastAction = "NextStepSolutionFast" // PreviousStepSolutionAction is the action for undoing to the previous solution step PreviousStepSolutionAction = "PreviousStepSolution" // PreviousStepSolutionFastAction is the action for undoing fast to the previous solution step PreviousStepSolutionFastAction = "PreviousStepSolutionFast" )
const ( TilePlayer = gloader.TilePlayer TileBox = gloader.TileBox TileGoal = gloader.TileGoal TileWall = gloader.TileWall TileEmpty = gloader.TileEmpty )
List of game tiles
const MaxAuthorLen = 6
MaxAuthorLen is the maximum highscore author length
Variables ¶
var RegexpHighscoreForbiddenChars = regexp.MustCompile("[[:^alnum:]]")
RegexpHighscoreForbiddenChars contains the list of forbidden characters is a highscore author
Functions ¶
func EncodeMovements ¶
func EncodeMovements(movements []MovementType) string
EncodeMovements encodes movements
func GetLastPackageName ¶
func GetLastPackageName() string
GetLastPackageName gets the last package name
func NormalizeHighScores ¶
func NormalizeHighScores(t HighscoreTable)
NormalizeHighScores normalizes highscores
func UpdateGameLayout ¶
func UpdateGameLayout(world w.World, gridLayout *GridLayout) (int, int)
UpdateGameLayout updates game layout
Types ¶
type EncodedSaveConfig ¶
type EncodedSaveConfig map[string]interface{}
EncodedSaveConfig contains the encoded save configuration
func (*EncodedSaveConfig) Decode ¶
func (esc *EncodedSaveConfig) Decode() (sc SaveConfig, err error)
Decode decodes the encoded save configuration
type Game ¶
type Game struct { StateEvent StateEvent Package PackageData Level Level GridLayout GridLayout SaveConfig SaveConfig }
Game contains game resources
type GamePrefabs ¶
type GamePrefabs struct { LevelInfo loader.EntityComponentList BoxInfo loader.EntityComponentList StepInfo loader.EntityComponentList PackageInfo loader.EntityComponentList }
GamePrefabs contains game prefabs
type HighscoreTable ¶
type MenuPrefabs ¶
type MenuPrefabs struct { MainMenu loader.EntityComponentList ChoosePackageMenu loader.EntityComponentList PauseMenu loader.EntityComponentList LevelCompleteMenu loader.EntityComponentList HighscoresMenu loader.EntityComponentList SolutionsMenu loader.EntityComponentList }
MenuPrefabs contains menu prefabs
type MovementType ¶
type MovementType uint8
MovementType is a movement type
const ( MovementUp MovementType = iota MovementDown MovementLeft MovementRight MovementUpPush MovementDownPush MovementLeftPush MovementRightPush )
List of movements
func DecodeMovements ¶
func DecodeMovements(encodedMovements string) []MovementType
DecodeMovements decodes movements
func GetPushMovement ¶
func GetPushMovement(m MovementType) MovementType
GetPushMovement returns push movement
func GetSimpleMovement ¶
func GetSimpleMovement(m MovementType) MovementType
GetSimpleMovement returns simple movement
type Prefabs ¶
type Prefabs struct { Menu MenuPrefabs Game GamePrefabs }
Prefabs contains game prefabs
type SaveConfig ¶
SaveConfig contains the save configuration
func EmptySaveConfig ¶
func EmptySaveConfig() SaveConfig
EmptySaveConfig returns an empty save configuration
func (*SaveConfig) Encode ¶
func (sc *SaveConfig) Encode() EncodedSaveConfig
Encode encodes the save configuration
type StateEvent ¶
type StateEvent int
StateEvent is an event for game progression
const ( StateEventNone StateEvent = iota StateEventLevelComplete )
List of game progression events