Module: PseudoGame.game.Game

Class that creates and manages all the game components allowing direct access to each component's polygons for transformation

Functions

PseudoGame.game.Game:new ([options]) the constructor for a game object
PseudoGame.game.Game:overwrite () overwrites the wall functions as well as custom walls function to modify the walls in this game (only if walls were specified in the components) IMPORTANT: once this function was called, you have to call Game:restore() before exiting your level (e.g.
PseudoGame.game.Game:restore () restores the original wall and custom wall functions
PseudoGame.game.Game:update (frametime, move, focus, swap) update the game
PseudoGame.game.Game:draw () puts all component collections polygons into Game.polygon_collection
PseudoGame.game.Game:draw_to_screen () draws all component collections onto the screen and updates it

Tables

pseudogame.game.game.component_collections
pseudogame.game.game.collections

Fields

pseudogame.game.game.options
pseudogame.game.game.polygon_collection
pseudogame.game.game.background
pseudogame.game.game.walls
pseudogame.game.game.player
pseudogame.game.game.death_effect
pseudogame.game.game.pivot
pseudogame.game.game.cap
pseudogame.game.game.pseudo3d


Functions

🔗 PseudoGame.game.Game:new ([options])
the constructor for a game object

Parameters:

Name Type(s) Description Default value
options Optional table options for the game object Undefined
components Optional table table telling the game what game components it needs to update, draw and which collections to return from Game:update (helps reducing lag if e.g. 3D isn't needed), just sets every component to true when not given Undefined
components.background Optional bool update and draw the background false
components.walls Optional bool update and draw the walls false
components.pivot Optional bool update and draw the pivot (including cap) false
components.player Optional bool update and draw the player (including death effect) false
components.pseudo3d Optional bool update and draw the 3d false
style Optional Style the style the game should use level_style
walls Optional table wall system options Undefined
player Optional table player options Undefined
pivot Optional table pivot options (only for the game component, not the actual pivot object) Undefined
pivot.cap Optional bool disables the cap if false true

Returns:

    Game
🔗 PseudoGame.game.Game:overwrite ()
overwrites the wall functions as well as custom walls function to modify the walls in this game (only if walls were specified in the components) IMPORTANT: once this function was called, you have to call Game:restore() before exiting your level (e.g. in onPreUnload), otherwise it may break other levels at random, as this function overwrites some default game functions
🔗 PseudoGame.game.Game:restore ()
restores the original wall and custom wall functions
🔗 PseudoGame.game.Game:update (frametime, move, focus, swap)
update the game

Parameters:

Name Type(s) Description
frametime number the time in 1/60s that passed since the last call of this function
move number the current movement direction, so either -1, 0 or 1
focus bool true if the player is focusing, false otherwise
swap bool true if the swap key is pressed, false otherwise
🔗 PseudoGame.game.Game:draw ()
puts all component collections polygons into Game.polygon_collection
🔗 PseudoGame.game.Game:draw_to_screen ()
draws all component collections onto the screen and updates it

Tables

🔗 pseudogame.game.game.component_collections

Fields:

Name Type(s) Description
component_collections table a table with the game component names as keys containing the polygon_collections for each component (use this for customized drawing)
background PolygonCollection the game's background (only exists if components.background == true)
walls PolygonCollection the game's walls (only exists if components.walls == true)
player PolygonCollection the game's player (only exists if components.player == true)
pivot PolygonCollection the game's pivot (only exists if components.pivot == true)
pseudo3d PolygonCollection the game's 3d (only exists if components.pseudo3d == true)
🔗 pseudogame.game.game.collections

Fields:

Name Type(s) Description
collections table same as Game.component_collections but instead of having named keys it's an ordered list that has the collections in the following order: background, pseudo3d, walls, pivot, player (if one of these components is not defined the list will be shorter and the other components are moved (use Game.component_collections for constant keys))

Fields

🔗 pseudogame.game.game.options
Name Type(s) Description
options table the game's options
🔗 pseudogame.game.game.polygon_collection
Name Type(s) Description
polygon_collection PolygonCollection the collection the Game:draw() method draws into
🔗 pseudogame.game.game.background
Name Type(s) Description
background Background the game's background (only exists if components.background == true)
🔗 pseudogame.game.game.walls
Name Type(s) Description
walls WallSystem the game's wall system (only exists if components.walls == true)
🔗 pseudogame.game.game.player
Name Type(s) Description
player Player the game's player (uses PseudoGame.game.basic_collision_handler by default) (only exists if components.player == true)
🔗 pseudogame.game.game.death_effect
Name Type(s) Description
death_effect DeathEffect the game's player's death effect (only exists if components.player == true)
🔗 pseudogame.game.game.pivot
Name Type(s) Description
pivot Pivot the game's pivot (only exists if components.pivot == true)
🔗 pseudogame.game.game.cap
Name Type(s) Description
cap Cap the game's cap (only exists if components.pivot == true)
🔗 pseudogame.game.game.pseudo3d
Name Type(s) Description
pseudo3d Pseudo3D the game's 3d effect (only exists if components.pseudo3d == true)
generated by LDoc 1.5.0