Module ...

Represent a game A module should subclass it and initialize anything it needs to play inside

Functions

_M:commandLineArgs (args) The C core gives us command line arguments
_M:defaultSavedFields (t) Defines the default fields to be saved by the savefile code
_M:display () Displays the screen Called by the engine core to redraw the screen every frame
_M:getPlayer () Returns the player Reimplement it in your module, this can just return nil if you dont want/need the engine adjusting stuff to the player or if you have many players or whatever
_M:getSaveDescription () Called by savefile code to describe the current game
_M:init (keyhandler) Constructor Sets up the default keyhandler.
_M:leaveLevel (level, lev, old_lev) Called when a zone leaves a level Going from "old_lev" to "lev", leaving level "level"
_M:onQuit () Called by the engine when the user tries to close the window
_M:onResolutionChange () Called when screen resolution changes
_M:registerDialog (d) Registers a dialog to display
_M:run () Starts the game Modules should reimplement it to do whatever their game needs
_M:saveGame () Requests the game to save
_M:saveSettings (file, data) Save a settings file
_M:setCurrent () Tells the game engine to play this game
_M:setFlyingText (fl) Sets up a text flyers
_M:setLevel (level) Sets the current level
_M:setPlayerName (name) Sets the player name
_M:setResolution (res) Change screen resolution
_M:tick () This is the "main game loop", do something here
_M:unregisterDialog (d) Undisplay a dialog, removing its own keyhandler if needed


Functions

_M:commandLineArgs (args)
The C core gives us command line arguments

Parameters

  • args:
_M:defaultSavedFields (t)
Defines the default fields to be saved by the savefile code

Parameters

  • t:
_M:display ()
Displays the screen Called by the engine core to redraw the screen every frame
_M:getPlayer ()
Returns the player Reimplement it in your module, this can just return nil if you dont want/need the engine adjusting stuff to the player or if you have many players or whatever
_M:getSaveDescription ()
Called by savefile code to describe the current game
_M:init (keyhandler)
Constructor Sets up the default keyhandler. Also requests the display size and stores it in "w" and "h" properties

Parameters

  • keyhandler:
_M:leaveLevel (level, lev, old_lev)
Called when a zone leaves a level Going from "old_lev" to "lev", leaving level "level"

Parameters

  • level:
  • lev:
  • old_lev:
_M:onQuit ()
Called by the engine when the user tries to close the window
_M:onResolutionChange ()
Called when screen resolution changes
_M:registerDialog (d)
Registers a dialog to display

Parameters

  • d:
_M:run ()
Starts the game Modules should reimplement it to do whatever their game needs
_M:saveGame ()
Requests the game to save
_M:saveSettings (file, data)
Save a settings file

Parameters

  • file:
  • data:
_M:setCurrent ()
Tells the game engine to play this game
_M:setFlyingText (fl)
Sets up a text flyers

Parameters

  • fl:
_M:setLevel (level)
Sets the current level

Parameters

  • level: an engine.Level (or subclass) object
_M:setPlayerName (name)
Sets the player name

Parameters

  • name:
_M:setResolution (res)
Change screen resolution

Parameters

  • res:
_M:tick ()
This is the "main game loop", do something here
_M:unregisterDialog (d)
Undisplay a dialog, removing its own keyhandler if needed

Parameters

  • d:

Valid XHTML 1.0!