Documentation ¶
Overview ¶
Package level deals with the reading, organisation and rendering of a level on screen. The following is an example of a level file, stored as JSON:
{ "version": "1", "levels": [ { "name": "level 1", "layers": [ { "name": "background", "image": { "path": "", "extra": {} }, "grid": { "assets": { "path": "", "quantity": 5, "offset": { "x": 0, "y": 0 } "width": 16, "height": 16 }, "tiles": [ { "asset": 0, "x": 10, "y": 10, "extra": "" } ], "extra": {} }, "bounds": [ { "type": "box", "dimensions": { "x": 10, "y": 10, "width": 20, "height": 20 }, "extra": "" } ] } ], "extra": "" } ] }
Index ¶
Constants ¶
View Source
const ( ErrorWrongFileFormat = "Loaded levels file is not a valid JSON" ErrorVersionNotSupported = "Version \"%s\" not supported" ErrorNoLevels = "Levels file must have at least one level declared, none found" )
Returned errors
Variables ¶
This section is empty.
Functions ¶
Types ¶
type GridAssets ¶
type Layer ¶
type Layer struct { Grid *Grid // contains filtered or unexported fields }
Layer contains the different structs a layer can hold and show on screen
type LevelsFile ¶
type LevelsFile struct { Version string Levels map[string]struct { Limits struct { Min pixel.Vec Max pixel.Vec } Layers map[string]struct { Image struct { Path string } Grid struct { Assets GridAssets Tiles []struct { Asset int X float64 Y float64 } } } } }
LevelsFile is the serialized form of Levels
Click to show internal directories.
Click to hide internal directories.