Legacy:Functions/Map: Difference between revisions
Jump to navigation
Jump to search
created, needs reformatting |
Reformat for new convention |
||
| Line 1: | Line 1: | ||
== Map and map engine control == | |||
* [[API:MapEngine|MapEngine]](''map_filename'', ''fps''): Start the map engine at ''map_filename'' at speed ''fps''. | |||
* [[API:GetCurrentMap|GetCurrentMap]](): Get the filename of the loaded map. | |||
* [[API:ChangeMap|ChangeMap]](''map_filename''): Change the current map of the map engine. | |||
* [[API:IsMapEngineRunning|IsMapEngineRunning]](): Check if the map engine is running or not. | |||
* [[API:UpdateMapEngine|UpdateMapEngine]](): Update state of map entities, animations and events in map engine. | |||
* [[API:ExitMapEngine|ExitMapEngine]](): Flag the map engine to exit on the next update. | |||
* | * [[API:RenderMap|RenderMap]](): Draw all map layers and persons to the back buffer. | ||
* [[API:GetMapEngineFrameRate|GetMapEngineFrameRate]](): Get the frames per second the map engine is running at. | |||
* [[API:SetMapEngineFrameRate|SetMapEngineFrameRate]](''fps''): Change map engine frame rate. | |||
== Map object == | |||
* Sphere [[API:Map|Map]] object: Holds map data. | |||
* [[ | * [[API:GetMapEngine|GetMapEngine]](): Obtain the current [[API:Map|Map]] object. | ||
* [[ | * [[API:Map/save|Map.save]](''filename''): Save a [[API:Map|Map]] object to ''filename''. | ||
* [[API:Map/layerAppend|Map.layerAppend]](''layer_width'', ''layer_height'', ''tile_index''): Adds a new layer to the [[API:Map|Map]] object. | |||
== Map scripts == | == Map scripts == | ||
* [[SetRenderScript]](''script''): Set ''script'' to run after each time the map is drawn. | * [[API:SetRenderScript]](''script''): Set ''script'' to run after each time the map is drawn. | ||
* [[SetUpdateScript]](''script''): Set ''script'' to run after each map engine update | * [[API:SetUpdateScript]](''script''): Set ''script'' to run after each map engine update. | ||
* Map event constants: | * [[API:CallMapScript]](''map_event''): Call map script associated with the current map. | ||
** <var>SCRIPT_ON_ENTER_MAP</var> | * [[API:CallDefaultMapScript]](''map_event''): Call map script set by [[SetDefaultMapScript]](). | ||
** <var>SCRIPT_ON_LEAVE_MAP</var> | * [[API:SetDefaultMapScript]](''map_event'', ''script''): Set map engine to run ''script'' when ''map_event'' occurs for any map. | ||
** <var>SCRIPT_ON_LEAVE_MAP_NORTH</var> | ** Map event constants: | ||
** <var>SCRIPT_ON_LEAVE_MAP_EAST</var> | **: <var>SCRIPT_ON_ENTER_MAP</var> | ||
** <var>SCRIPT_ON_LEAVE_MAP_SOUTH</var> | **: <var>SCRIPT_ON_LEAVE_MAP</var> | ||
** <var>SCRIPT_ON_LEAVE_MAP_WEST</var> | **: <var>SCRIPT_ON_LEAVE_MAP_NORTH</var> | ||
**: <var>SCRIPT_ON_LEAVE_MAP_EAST</var> | |||
**: <var>SCRIPT_ON_LEAVE_MAP_SOUTH</var> | |||
**: <var>SCRIPT_ON_LEAVE_MAP_WEST</var> | |||
* [[SetDelayScript]](''frames'', ''script''): Run ''script'' after ''frames'' delay. | * [[API:SetDelayScript]](''frames'', ''script''): Run ''script'' after ''frames'' delay. | ||
== Within the map engine == | == Within the map engine == | ||
* [[SetColorMask]](''color'', ''frames''): Draws ''color'' over the map engine for ''frames'' duration. | * [[API:SetColorMask]](''color'', ''frames''): Draws ''color'' over the map engine for ''frames'' duration. | ||
=== Maps === | === Maps === | ||
{{API:Functions/Map/Zones}} | |||
{{API:Functions/Map/Triggers}} | |||
{{API:Functions/Map/Layers}} | |||
{{API:Functions/Map/Tiles}} | |||
=== Input === | === Input === | ||
{{API:Functions/Map/Input}} | |||
=== Camera === | === Camera === | ||
{{API:Functions/Map/Camera}} | |||
=== Persons === | === Persons === | ||
{{API:Functions/Map/Entities}} | |||
Revision as of 23:49, 1 June 2013
Map and map engine control
- MapEngine(map_filename, fps): Start the map engine at map_filename at speed fps.
- GetCurrentMap(): Get the filename of the loaded map.
- ChangeMap(map_filename): Change the current map of the map engine.
- IsMapEngineRunning(): Check if the map engine is running or not.
- UpdateMapEngine(): Update state of map entities, animations and events in map engine.
- ExitMapEngine(): Flag the map engine to exit on the next update.
- RenderMap(): Draw all map layers and persons to the back buffer.
- GetMapEngineFrameRate(): Get the frames per second the map engine is running at.
- SetMapEngineFrameRate(fps): Change map engine frame rate.
Map object
- Sphere Map object: Holds map data.
- GetMapEngine(): Obtain the current Map object.
- Map.save(filename): Save a Map object to filename.
- Map.layerAppend(layer_width, layer_height, tile_index): Adds a new layer to the Map object.
Map scripts
- API:SetRenderScript(script): Set script to run after each time the map is drawn.
- API:SetUpdateScript(script): Set script to run after each map engine update.
- API:CallMapScript(map_event): Call map script associated with the current map.
- API:CallDefaultMapScript(map_event): Call map script set by SetDefaultMapScript().
- API:SetDefaultMapScript(map_event, script): Set map engine to run script when map_event occurs for any map.
- Map event constants:
- SCRIPT_ON_ENTER_MAP
- SCRIPT_ON_LEAVE_MAP
- SCRIPT_ON_LEAVE_MAP_NORTH
- SCRIPT_ON_LEAVE_MAP_EAST
- SCRIPT_ON_LEAVE_MAP_SOUTH
- SCRIPT_ON_LEAVE_MAP_WEST
- Map event constants:
- API:SetDelayScript(frames, script): Run script after frames delay.
Within the map engine
- API:SetColorMask(color, frames): Draws color over the map engine for frames duration.