Difference between revisions of "Legacy:Functions/Map"

From Spherical
Jump to: navigation, search
m (Maps: rename section)
(Map Elements)
Line 41: Line 41:
 
=== Map Elements ===
 
=== Map Elements ===
  
{{API:Functions/Map/Zones}}
+
{{Legacy:Functions/Map/Zones}}
  
{{API:Functions/Map/Triggers}}
+
{{Legacy:Functions/Map/Triggers}}
  
{{API:Functions/Map/Layers}}
+
{{Legacy:Functions/Map/Layers}}
  
{{API:Functions/Map/Tiles}}
+
{{Legacy:Functions/Map/Tiles}}
  
 
=== Input ===
 
=== Input ===

Revision as of 09:13, 19 June 2017

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.

Map object

  • Sphere Map object: Holds map data.

Map scripts

  • SetRenderScript(script): Set script to run after each time the map is drawn.
  • SetUpdateScript(script): Set script to run after each map engine update.
  • CallMapScript(map_event): Call map script associated with the current map.
  • CallDefaultMapScript(map_event): Call map script set by SetDefaultMapScript().
  • 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 Elements

Zones

  • AreZonesAt(x, y, layer): Check if there are any zones at (x, y) on layer.
  • ExecuteZones(x, y, layer): Run all scripts for zones that (x, y) on layer is in.
  • GetNumZones(): Get the number of zones on the current map.
For each zone
Zone position
  • GetZoneX(zone): Get the X coordinate of zone on the map.
  • GetZoneY(zone): Get the Y coordinate of zone on the map.
  • GetZoneWidth(zone): Get the pixel width of zone.
  • GetZoneHeight(zone): Get the pixel height of zone.

Triggers

  • IsTriggerAt(x, y, layer): Check if there is a trigger at pixel coords (x, y) on layer.
  • ExecuteTrigger(x, y, layer): Activate the trigger at (x, y) on layer if one exists.

Layers

Tiles

  • GetNumTiles(): Get the number of tiles in the current map tileset.
  • GetTileWidth(): Get the image width of tiles in the current map tileset.
  • GetTileHeight(): Get the image height of tiles in the current map tileset.
  • GetTile(tile_x, tile_y, layer): Get the tileset index of the tile at the given map position.
  • SetTile(tile_x, tile_y, layer, tile): Plot a tile at the given map location.
  • ReplaceTilesOnLayer(layer, old_tile, new_tile): Substitute all old_tile with new_tile on layer.
Tile animations
  • GetTileDelay(tile): Get frame delay of animated tile.
  • SetTileDelay(tile, delay): Set a frame delay for this tile animation frame.

Input

API:Functions/Map/Input

Camera

API:Functions/Map/Camera

Persons

API:Functions/Map/Entities