Documentation ¶
Index ¶
- Variables
- func GetTotalLevels() int
- func LoadLevel() int
- func StartGame()
- type Border
- type Coordinates
- type Crate
- func (crate *Crate) CheckActivatedGoalCollision(g *Goal) bool
- func (crate *Crate) CheckBorderCollision() bool
- func (crate *Crate) CheckCrateCollision(crates []*Crate) bool
- func (crate *Crate) CheckGoalCollision(g *Goal) bool
- func (crate *Crate) CopyCrateSlice() []*Crate
- func (crate *Crate) Draw(screen *tl.Screen)
- func (crate *Crate) MoveCrate(dir string, colliding bool)
- func (crate *Crate) RemoveCrate(slice []*Crate, i int) []*Crate
- type EntityCollection
- type GameCompletionScreen
- type Gamescreen
- func (gs *Gamescreen) AddGameEntities()
- func (gs *Gamescreen) ChangeLevel(selection string)
- func (gs *Gamescreen) CheckLevelCompletion() bool
- func (gs *Gamescreen) MapLevel()
- func (gs *Gamescreen) Move(dir string)
- func (gs *Gamescreen) RemoveGameEntities()
- func (gs *Gamescreen) RestartLevel()
- func (gs *Gamescreen) SaveGame()
- func (gs *Gamescreen) Tick(event tl.Event)
- func (gs *Gamescreen) UpdateText()
- type Goal
- type Player
- func (player *Player) CalculatePlayerCoordinates(dir string) Coordinates
- func (player *Player) CheckActivatedGoalCollision(g *Goal, dir string) bool
- func (player *Player) CheckBorderCollision(dir string) bool
- func (player *Player) CheckCrateCollision(c *Crate, dir string) bool
- func (player *Player) Draw(screen *tl.Screen)
- func (player *Player) MovePlayer(dir string, colliding bool)
- type Stopwatch
- type Titlescreen
Constants ¶
This section is empty.
Variables ¶
var CurrentLevel int
CurrentLevel this integer will determine the level you are currently on.
var TotalLevels = GetTotalLevels()
TotalLevels this integer represents the total amount of levels.
Functions ¶
Types ¶
type Border ¶
Border inherits the entity making it a drawable. It also consists of the bordercoordinates in a map.
type Coordinates ¶
Coordinates is used to save the X and Y coordinates of multiple entities.
type Crate ¶
type Crate struct { *tl.Entity Coordinates }
Crate inherits the entity making it a drawable, it also inherits the coordinates struct, and has a bool for the rachedgoal check.
func NewCrate ¶
func NewCrate() *Crate
NewCrate creates an entity for the crate and returns a pointer to a crate
func (*Crate) CheckActivatedGoalCollision ¶
CheckActivatedGoalCollision check if the crate is colliding with an activated goal, if so it will return true.
func (*Crate) CheckBorderCollision ¶
CheckBorderCollision will check if the crate has a collision with the border. If so, this will return true.
func (*Crate) CheckCrateCollision ¶
CheckCrateCollision check whether the given crate is colliding with any other crate
func (*Crate) CheckGoalCollision ¶
CheckGoalCollision check if the crate is colliding with the goal, if so it will return true.
func (*Crate) CopyCrateSlice ¶
CopyCrateSlice create a duplicate of the crate entity slice
type EntityCollection ¶
EntityCollection collection of all entities within the game.
func NewEntityCollection ¶
func NewEntityCollection() *EntityCollection
NewEntityCollection creates a collection of all the entities in the game
type GameCompletionScreen ¶
GameCompletionScreen is the level of the victory screen, displaying when you finish all levels.
func NewGameCompletionScreen ¶
func NewGameCompletionScreen() *GameCompletionScreen
NewGameCompletionScreen will create a new gamecompletionscreen for when all levels are beaten.
func (*GameCompletionScreen) SaveTime ¶
func (gs *GameCompletionScreen) SaveTime(finalTime string)
SaveTime save your collective time after beating the game.
func (*GameCompletionScreen) Tick ¶
func (gcs *GameCompletionScreen) Tick(event tl.Event)
Tick listens to keyinput on the titlescreen, so if the enter key is pressed, the game will start.
type Gamescreen ¶
type Gamescreen struct { tl.Level UI *tl.Entity CurrentLevelText *tl.Text Time *tl.Text Instructions []*tl.Text SaveConfirmation *tl.Text LevelCompleted *tl.Text }
Gamescreen is the level for the gamescreen.
func NewGameScreen ¶
func NewGameScreen() *Gamescreen
NewGameScreen will create a new gamescreen with the currentleveltext, instructions and the level itself and return it where it is called.
func (*Gamescreen) AddGameEntities ¶
func (gs *Gamescreen) AddGameEntities()
AddGameEntities create all entities on the game screen and map level
func (*Gamescreen) ChangeLevel ¶
func (gs *Gamescreen) ChangeLevel(selection string)
ChangeLevel will change the level given the player input.
func (*Gamescreen) CheckLevelCompletion ¶
func (gs *Gamescreen) CheckLevelCompletion() bool
CheckLevelCompletion will remove the crate entity and print a text when the level is beaten.
func (*Gamescreen) MapLevel ¶
func (gs *Gamescreen) MapLevel()
MapLevel reads from a level file and maps the coordinates for all of the entities
func (*Gamescreen) Move ¶
func (gs *Gamescreen) Move(dir string)
Move calculate and check collisions for the current move
func (*Gamescreen) RemoveGameEntities ¶
func (gs *Gamescreen) RemoveGameEntities()
RemoveGameEntities delete all entities on the game screen.
func (*Gamescreen) RestartLevel ¶
func (gs *Gamescreen) RestartLevel()
RestartLevel is a function that will reset the level by setting all of the entites to their default positions.
func (*Gamescreen) SaveGame ¶
func (gs *Gamescreen) SaveGame()
SaveGame save your current level to a file and show a confirmation.
func (*Gamescreen) Tick ¶
func (gs *Gamescreen) Tick(event tl.Event)
Tick listens to the gamescreen input and handles it accordingly.
func (*Gamescreen) UpdateText ¶
func (gs *Gamescreen) UpdateText()
UpdateText will update the text on the game screen. This function is called when the level is changed
type Goal ¶
type Goal struct { *tl.Entity Coordinates // contains filtered or unexported fields }
Goal inherits the entity making it a drawable, it also inherits the coordinates struct.
type Player ¶
type Player struct { *tl.Entity Border Coordinates }
Player inherits the entity making it a drawable, it also inherits the border and coordinates struct.
func NewPlayer ¶
func NewPlayer() *Player
NewPlayer creates an entity for the player and returns a pointer to a player
func (*Player) CalculatePlayerCoordinates ¶
func (player *Player) CalculatePlayerCoordinates(dir string) Coordinates
CalculatePlayerCoordinates calculates the coordinates from the player for current move
func (*Player) CheckActivatedGoalCollision ¶
CheckActivatedGoalCollision will check if the player is colliding an activated goal.
func (*Player) CheckBorderCollision ¶
CheckBorderCollision will check if the player is colliding with the border.
func (*Player) CheckCrateCollision ¶
CheckCrateCollision will check if the player is colliding with the crate.
func (*Player) Draw ¶
Draw will print the entity of the player and update it every tick. It also prints the cells for the instructions.
func (*Player) MovePlayer ¶
MovePlayer move the player if there is no collision, else it will take a step back(entity doesn't move)
type Stopwatch ¶
type Stopwatch struct {
// contains filtered or unexported fields
}
Stopwatch to keep track of your best times
func (*Stopwatch) CheckpointTime ¶
CheckpointTime subtract the start time of the current time and return it as a string.
func (*Stopwatch) FinishTime ¶
FinishTime subtract the start time of the stoptime to get the total time.
type Titlescreen ¶
Titlescreen is the level for the titlescreen.
func NewTitleScreen ¶
func NewTitleScreen() *Titlescreen
NewTitleScreen will create a new titlescreen and read from the logo file to print out the ASCII art logo. This function will return a pointer to titlescreen.
func (*Titlescreen) Tick ¶
func (ts *Titlescreen) Tick(event tl.Event)
Tick listens to keyinput on the titlescreen, so if the enter key is pressed, the game will start.