Class Index | File Index

Classes


Class VENISON.TOOLS.LevelLoader

A singleton with methods to load and unload levels, as well as copying and pasting entities and extracting XML-data from the current level, etc.
Defined in: venison_engine.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
Method Summary
Method Attributes Method Name and Description
 
fnCopyEntities(iEntities, iUseEntityAttributes)
Create an xml-DOM from in-world entities, by copying either the current values of their attributes or the default values of their properties' attributes.
 
fnGetXMLStringFromCurrentLevel(iUseEntityAttributes)
Function useful to save the current level etc.
 
fnLoadLevelFromFile(iLevelFileName)
Loads a level from an xml-file located on the server.
 
fnLoadLevelFromString(iLevelString)
Loads a level from an xml-string.
 
fnPasteEntities(iXMLRoot)
Insert entities in xml-form into the world.
 
Unload the current level.
Class Detail
VENISON.TOOLS.LevelLoader()
Method Detail
{Object} fnCopyEntities(iEntities, iUseEntityAttributes)
Create an xml-DOM from in-world entities, by copying either the current values of their attributes or the default values of their properties' attributes.
Parameters:
{Array} iEntities
An array of VENISON.ENTITY.GameEntity.
{Boolean} iUseEntityAttributes
true if the current values of the entities' attributes should be copied, false if the default values of their properties' attributes should be used.
Returns:
{Object} A pointer to an xml-DOM describing the entities, preferably to be passed as an argument to VENISON.TOOLS.LevelLoader#fnPasteEntities.

{String} fnGetXMLStringFromCurrentLevel(iUseEntityAttributes)
Function useful to save the current level etc.
Parameters:
{Boolean} iUseEntityAttributes
If true, the attributes values are taken from the entity to which they belong, otherwise they are taken from the default values of the corresponding properties. Example: A player has an 'extraLives' attribute, defined by a property in which it's default value is 3. However, the player has died 2 times, so the value of the entity's attribute is now 1. If this parameter is set to true, the 'extraLives' attribute of the returned entity would have the value 1, otherwise it would have the value 3, as it would use the default value defined in the property.
Returns:
{String} A string containing an XML-structure describing the current state of the level.

{Object} fnLoadLevelFromFile(iLevelFileName)
Loads a level from an xml-file located on the server. The level described within the file with name iLevelFileName in the level directory on the server is loaded into the world. NOTE: The previous level is not unloaded, the new entities are simply added after the existing ones.
Parameters:
{String} iLevelFileName
The name of a file existing in the level directory on the server. Example: 'meatfactory_1337.xml' is similar to 'meatfactory_1337', since it is implied that the file is of xml type.
Returns:
{Object} The xml-DOM created from the file.

{Object} fnLoadLevelFromString(iLevelString)
Loads a level from an xml-string. NOTE: The previous level is not unloaded, the new entities are simply added after the existing ones.
Parameters:
{String} iLevelString
The string in xml-format describing the level.
Returns:
{Object} The xml-DOM created from the string.

{Array} fnPasteEntities(iXMLRoot)
Insert entities in xml-form into the world.
Parameters:
{Object} iXMLRoot
a pointer to the root of an XML DOM object containing entities, as returned by VENISON.TOOLS.LevelLoader#fnCopyEntities.
Returns:
{Array} An array of VENISON.ENTITY.GameEntity inserted into the world.

fnUnloadCurrentLevel()
Unload the current level. After this call, the game world will be empty.

Documentation generated by JsDoc Toolkit 2.4.0 on Thu May 05 2011 18:47:29 GMT+0200 (CEST)