World
Extends: Node2D
Description
The World is the class that holds all visible elements of a map.
Accessed by Global.World
.
Properties
Polygon2D | Bounds |
Polygon2D | ExportFX |
String | Title |
int | Width |
int | Height |
int | GridSize |
int | TileSize |
Vector2 | Dimensions |
Vector2 | WoxelDimensions |
Rect2 | WorldRect |
Vector2 | GridCellSize |
Level[] | levels |
int | CurrentLevelId |
Sprite | TraceImage |
bool | TraceImageVisible |
Dictionary | NodeLookup |
int | nextNodeID |
Dictionary | LevelLookup |
int | nextLevelID |
int | nextPrefabID |
Dictionary | EmbeddedTextures |
Texture | BuildingWear |
bool | WallShadow |
bool | ObjectShadow |
int | Format |
Methods
Property Descriptions
- Polygon2D Bounds:
A frame around the map to ensure no map contents draw from over the edge can be seen.
- Polygon2D ExportFX:
The pane that adds a post process filter for export like blurring or color grading.
- String Title:
Name of the map given by the user. READ ONLY.
- int Width:
Width in cells of the map. READ ONLY.
- int Height:
Height in cells of the map. READ ONLY.
- int GridSize:
Unit size in each grid cell of the map. READ ONLY.
- int TileSize:
Unit size in each floor tile of the map. READ ONLY.
- Vector2 Dimensions:
Size of the map in grid cells. READ ONLY.
- Vector2 WoxelDimensions:
Size of the map in units (pixels if exported at full resolution). READ ONLY.
- Rect2 WorldRect:
Rect of the map in world space.
- Vector2 GridCellSize:
Size of each grid cell in world space.
- Level[] levels:
Get all of the levels of this map.
- int CurrentLevelId:
Get the ID of the currently visible level of this map. READ ONLY.
- Sprite TraceImage:
The trace image that overlays the map to help draw.
- bool TraceImageVisible:
Gets or sets if the trace image is visible.
- Dictionary NodeLookup:
Get the table of int key - Node value pair to find an asset instance by its node id.
- int nextNodeID:
Gets the next node id available for assignment. DO NOT MODIFY.
- Dictionary LevelLookup:
Get the table of int key - Level value pair to find a level by its id.
- int nextLevelID:
Gets the next level id available. DO NOT MODIFY.
- int nextPrefabID:
Gets the next prefab id available. DO NOT MODIFY.
- Dictionary EmbeddedTextures:
Get the table of String key - Texture value pair to find embedded Prop textures.
- Texture BuildingWear:
Get the texture used to wear the building walls and floors. Set with SetBuildingWear().
- bool WallShadow:
Toggle if the new walls created will have shadows.
- bool ObjectShadow:
Toggle if the new props created will have shadows.
- int Format:
Get the save format version.
Method Descriptions
- Dictionary Save ( ):
Save the world into the save file format and return it as a Dictionary.
- void Load ( Dictionary data ):
Load a saved World data. Used by a saved map file to load an existing world.
- Dictionary SaveLevels ( ):
Save all levels into the save file format and return it as a Dictionary. Called by Save().
- void LoadLevels ( Dictionary data ):
Load a saved data of all levels. Used by a saved map file to load an existing world. Called by Load().
- void AssignLevelID ( Level level ):
Assign a new level an id. Called automatically on level creation. No need to manually call.
- Level GetLevelByID ( int id ):
Returns the Level object by providing its id.
- Level CreateLevel ( String label ):
Create a new Level with the name label.
- void DeleteLevel ( Level level ):
Delete a Level from existence.
- void LoadLevel ( int index, Dictionary data ):
Load a level data into a specific index. Used by LoadLevels().
- Level CloneLevel ( Level level, String label ):
Clones an existing level and returns the clone as the new one.
- Level TryGetLevel ( int index ):
Get a level safely. Will not crash if an invalid index is provided. Just returns null.
- void SetNewLevelOrder ( Level[] newOrder ):
Set a new level order by providing it with an array of levels in order and update UI elements to reflect it.
- String GetNextPrefabID ( ):
Generate a new prefab id and increment the next available id.
- int AssignNodeID ( Node node ):
Assign the input Asset Instance a node id and increment the next available id.
- void AssignSpecificNodeID ( Node node, int id ):
Assign the input Asset Instance a node id an exact id. Id cannot already exist.
- void RemoveNodeID ( int id ):
Delete a node ID from the registry. Called whenever an Asset Instance was deleted.
- void SetNodeID ( Node node, int id ):
Register the node id. Called by AssignNodeID() and AssignSpecificNodeID().
- Node GetNodeByID ( int id ):
Returns the Asset Instance by providing its id.
- bool DeleteNodeByID ( int id ):
Deletes an Asset Instance by providing its id. Returns true if succesful.
- void LevelDown ( ):
Go down a level.
- void LevelUp ( ):
Go up a level.
- void SetLevel ( int level, bool loading = false ):
Change the active level. The parameter loading is set when the level change is from a map load.
- Level GetCurrentLevel ( ):
Get the level currently visible and editable to the user.
- void HideAllLevels ( ):
Make all levels invisible.
- void SetSourceLevel ( int level ):
Set a source level for export. Mostly used by the Exporter.
- void SetOverlayLevel ( int level, float opacity ):
Set an overlay level for export. Mostly used by the Exporter.
- void Start ( ):
Called at the start of the map creation to initialize the GridMesh, Bounds, and ExportFX.
- void SetCompareLevels ( Level referenceLevel, float referenceOpacity, float currentOpacity, bool saveSetting ):
Set up having two levels disable on top of each other for referencing, like when drawing multiple floors. Set saveSetting to true if called manually.
- void DisableCompareLevels ( ):
Disable an existing level comparison.
- void RestoreLevelsPostExport ( ):
Called by the Exporter to restore any temporary changes made by the Exporter to generate the final image.
- void UpdateLayerMenu ( OptionButton menu, int activeLayer ):
Called automatically whenever the active layer changes to update layer UI menus.
- void AddTraceImage ( String path, float scale, float opacity ):
Load a new trace image from a file path.
- void RemoveTraceImage ( ):
Delete the trace image.
- void CenterTraceImage ( ):
Centers the trace image to the canvas.
- void HandleTraceImageExportVisibility ( bool exporting ):
Called by the Exporter to hide the trace image during exports.
- Dictionary SaveEmbedded ( ):
Saves any embedded images in save data format and return as a Dictionary. Used by Save().
- void LoadEmbedded ( Dictionary data ):
Loads any embedded images from a save format. Used by Load().
- void SetBuildingWear ( Texture texture ):
Change the building wear texture.