Engine

The engine class provides core functionality that has affects across multiple game instances.
Return to Index
static game ( ) -> ( am.game )
static game ( am.game game ) -> ( )
static grid_size ( ) -> ( number )
static grid_size ( number size ) -> ( )
static using_tile_set ( string tile_set_name ) -> ( )
static clear_using_tile_set ( ) -> ( )
static tile ( string tile_name ) -> ( am.tile )
static tile_set ( string tile_set_name ) -> ( am.tile_set )
static add_tile_set ( am.tile_set tile_set ) -> ( )
static top_level_tile_set ( ) -> ( am.tile_set )
static game_object ( string game_id ) -> ( am.game_object )
static register_game_object ( am.game_object game_object ) -> ( )
static deregister_game_object ( string game_id ) -> ( )
static deregister_game_object ( am.game_object game_object ) -> ( )
static add_race ( am.race race ) -> ( boolean )
static remove_race ( string race_name ) -> ( boolean )
static remove_race ( am.race race ) -> ( boolean )
static race ( string race_name ) -> ( am.race )
static unknown_race ( ) -> ( am.race )
static add_tile_type ( am.tile_type tile_type ) -> ( )
static tile_type ( string tile_type_name ) -> ( am.tile_type )
static bgm ( ) -> ( am.sound )
static bgm ( string filename ) -> ( boolean )
static bgm ( am.sound bgm ) -> ( )
static bgm ( nil turn_off ) -> ( )
static game ( ) -> ( am.game )
Returns the current game set on the engine, can be nil if there is no game running.
Returns:
am.game : The current game.
static game ( am.game game ) -> ( )
Sets the current game.
Parameters:
am.game game : The new current game
static grid_size ( ) -> ( number )
Returns the grid size in pixels for the tiles in the game.
Returns:
number : Grid size
static grid_size ( number size ) -> ( )
Sets the grid size in pixels for the tiles in the game.
Parameters:
number size : The grid size
static using_tile_set ( string tile_set_name ) -> ( )
Adds a tile set name to look up when loading tiles. This allows maps to defines the list of tiles without having to specify the tile set each time.
Parameters:
string tile_set_name : The tile set name to use
static clear_using_tile_set ( ) -> ( )
Clears the current list of tile sets that are in use.
static tile ( string tile_name ) -> ( am.tile )
Looks up a tile based on its name and the current list of tile sets in use.
Parameters:
string tile_name : The tile name to look up.
Returns:
am.tile : The found tile, or nil.
static tile_set ( string tile_set_name ) -> ( am.tile_set )
Looks up a tile set based on its name.
Parameters:
string tile_set_name : Tile set name to look up
Returns:
am.tile_set : The found tile set or nil.
static add_tile_set ( am.tile_set tile_set ) -> ( )
Adds a tile set to the game engines list of tile sets.
Parameters:
am.tile_set tile_set : The tile set to add.
static top_level_tile_set ( ) -> ( am.tile_set )
Returns the top level tile set. The top level tile set is the default tile set which all tile look ups will look up if all others fail.
Returns:
am.tile_set : The top level tile set.
static game_object ( string game_id ) -> ( am.game_object )
Looks up a game object by gameId. Returns a game object if found, nil otherwise.
Parameters:
string game_id : The game id to look up.
Returns:
am.game_object : The found game object, nil if not found.
static register_game_object ( am.game_object game_object ) -> ( )
Registers a game object with the current game so that it can be looked up from anywhere. This is just shorthand for getting the current game and registering the game object with that.
Parameters:
am.game_object game_object : The game object to register with the game engine.
static deregister_game_object ( string game_id ) -> ( )
Removes a game object from the current game. This is just shorthand for removing the game object from the current game.
Parameters:
string game_id : The game id of the game object to remove.
static deregister_game_object ( am.game_object game_object ) -> ( )
Removes a game object from the game engine. This is just shorthand for removing the game object from the current game.
Parameters:
am.game_object game_object : The game object to remove.
static add_race ( am.race race ) -> ( boolean )
Adds a race to the game engine.
Parameters:
am.race race : The race to add.
Returns:
boolean : True if the race was successfully added.
static remove_race ( string race_name ) -> ( boolean )
Removes a race from the game engine.
Parameters:
string race_name : The name of the race to remove.
Returns:
boolean : True if the race was sucessfully removed.
static remove_race ( am.race race ) -> ( boolean )
Removes a race from the game engine.
Parameters:
am.race race : The race to remove.
Returns:
boolean : True if the race was sucessfully removed.
static race ( string race_name ) -> ( am.race )
Looks up a race in the game engine by name.
Parameters:
string race_name : The race name to look up.
Returns:
am.race : The found race or nil.
static unknown_race ( ) -> ( am.race )
Returns the 'unknown' race.
Returns:
am.race : The unknown race
static add_tile_type ( am.tile_type tile_type ) -> ( )
Adds a tile type to the game engine.
Parameters:
am.tile_type tile_type : The type to add.
static tile_type ( string tile_type_name ) -> ( am.tile_type )
Looks up a tile tpye by name.
Parameters:
string tile_type_name : The name of the tile type to lookup.
Returns:
am.tile_type : The found tile type or nil.
static bgm ( ) -> ( am.sound )
Returns the sound object of the currently playing background music.
Returns:
am.sound : The current playing background music sound object.
static bgm ( string filename ) -> ( boolean )
Sets the background music to stream from the given filename. Unsupported files or unfound files will not change the music.
Parameters:
string filename : The filename of the file to stream as music.
Returns:
boolean : True if the music was successfully changed.
static bgm ( am.sound bgm ) -> ( )
Sets the background music to the given sound object. The background music source is always set to be looping, so this works best with music designed for looping or with cue points.
Parameters:
am.sound bgm : The new sound object to use as background music.
static bgm ( nil turn_off ) -> ( )
Turns the background music off.
Parameters:
nil turn_off : Turns music off.