Level
Extends: Node2D
Description
This object holds nearly every visible asset or item you can place onto a map. Consider it a floor of your dungeon.
Properties
int | ID |
FloorTileMap | TileMap |
FloorShapes | FloorShapes |
PatternShapes | PatternShapes |
CaveMesh | CaveMesh |
Terrain | Terrain |
WaterMesh | WaterMesh |
Walls | Walls |
Node2D | Portals |
Pathways | Pathways |
Objects | Objects |
Roofs | Roofs |
Lights | Lights |
Texts | Texts |
Node2D | MaterialMeshes |
Dictionary | MeshLookup |
Dictionary | Data |
bool | WasLoaded |
bool | Cloning |
String | Label |
Viewport | FloorRT |
FloorTileCamera | FloorTileCamera |
ColorRect | LightPassRender |
BackBufferCopy | LightPassBBC |
Methods
Dictionary | Save ( ) |
void | Load ( Dictionary data ) |
void | Resize ( int x, int y, int w, int h ) |
void | CreateDefaultLockedLayers ( ) |
void | CreateDefaultUserLayers ( ) |
Dictionary | SaveLayers ( ) |
void | LoadLayers ( Dictionary data ) |
MaterialMesh | GetOrMakeMaterialMesh ( int layer, Texture texture, bool smoothDefault ) |
void | AddMaterialLayer ( int layer ) |
void | CleanMaterialMeshes ( ) |
bool | IsMeshEmpty ( int layer, Texture texture ) |
Dictionary | SaveMaterialMeshes ( ) |
void | LoadMaterialMeshes ( Dictionary data ) |
void | CreateFreestandingPortal ( Texture texture, Vector2 position, bool closed, float radius, float rotation ) |
Dictionary[] | SaveFreestandingPortals ( ) |
void | LoadFreestandingPortals ( Dictionary[] data ) |
Portal | LoadFreestandingPortal ( Dictionary item ) |
Dictionary | SaveEnvironment ( ) |
void | LoadEnvironment ( Dictionary data ) |
void | UpdateFloorRT ( Vector2 size ) |
void | ToggleLighting ( bool value ) |
Dictionary | Deserialize ( String text ) |
Rect2 | GetSelectionRect ( Dictionary things ) |
Property Descriptions
- int ID:
Numerical ID of the level
- FloorTileMap TileMap:
Gets the tilemap that draws the tiling style of floor shapes.
- FloorShapes FloorShapes:
Gets the parent of the polygons that draw the tilemap for floors.
- PatternShapes PatternShapes:
Gets the parent of the pattern shapes.
- CaveMesh CaveMesh:
Gets the cave mesh.
- Terrain Terrain:
Gets the terrain.
- WaterMesh WaterMesh:
Gets the water mesh.
- Walls Walls:
Gets the parent of the walls.
- Node2D Portals:
Gets the parent of the portals.
- Pathways Pathways:
Gets the parent of the pathways.
- Objects Objects:
Gets the parent of the objects.
- Roofs Roofs:
Gets the parent of the roofs.
- Lights Lights:
Gets the parent of the lights.
- Texts Texts:
Gets the parent of the texts.
- Node2D MaterialMeshes:
Gets the parent of the materials.
- Dictionary MeshLookup:
Table of String key - MarchingSquaresMesh value pairs to lookup meshes by their IDs. Cave is specifically labelled "Cave", while Materials are auto-generated and need to be referenced by their LookupID.
- Dictionary Data:
Gets or sets the saved data that was used to load this Level.
- bool WasLoaded:
Gets if this Level was loaded from saved data. Read only.
- bool Cloning:
Gets if this Level is one that is a clone still in the process of cloning. Read only.
- String Label:
Get or set the name of the level.
- Viewport FloorRT:
Offscreen viewport to render any floor tiles.
- FloorTileCamera FloorTileCamera:
Offscreen camera to render floor tiles to a texture that will be used in the main viewport as a ViewportTexture.
- ColorRect LightPassRender:
Full screen rect used to combine lighting into a single deferred pass.
- BackBufferCopy LightPassBBC:
Special Godot class used to render the viewport to a texture to use for lighting.
Method Descriptions
- Dictionary Save ( ):
Save the level into the save file format and return it as a Dictionary. Calls the Save() method in all the assets inside this level as well.
- void Load ( Dictionary data ):
Load a saved level data. Used by a saved map file to load existing levels.
- void Resize ( int x, int y, int w, int h ):
Called automatically when the canvas is resized. DO NOT CALL DIRECTLY. FOR REFERENCE ONLY.
- void CreateDefaultLockedLayers ( ):
Called automatically upon creation to create the locked layers to protect layers used by special assets.
- void CreateDefaultUserLayers ( ):
Called automatically upon creation to create the user layers.
- Dictionary SaveLayers ( ):
Save any assets in layers into the save file format and return it as a Dictionary. Calls the Save() method in all the assets inside this level as well.
- void LoadLayers ( Dictionary data ):
Load a saved level's layers data. Used by a saved map file to load existing levels.
- MaterialMesh GetOrMakeMaterialMesh ( int layer, Texture texture, bool smoothDefault ):
Gets the MaterialMesh at the layer with the specified texture. If non-existent, then create a new one.
- void AddMaterialLayer ( int layer ):
Create a new material layer
- void CleanMaterialMeshes ( ):
Delete any material meshes that no longer have any shapes painted.
- bool IsMeshEmpty ( int layer, Texture texture ):
Checks if any material texture at a certain layer is empty of shapes.
- Dictionary SaveMaterialMeshes ( ):
Save materials into the save file format and return it as a Dictionary. Called by the Save() method.
- void LoadMaterialMeshes ( Dictionary data ):
Load a saved level's materials data. Used by a saved map file to load existing levels. Called by the Load() method.
- void CreateFreestandingPortal ( Texture texture, Vector2 position, bool closed, float radius, float rotation ):
Create a freestanding portal in this level
- Dictionary[] SaveFreestandingPortals ( ):
Save freestanding portals into the save file format and return it as an Array. Called by the Save() method.
- void LoadFreestandingPortals ( Dictionary[] data ):
Load a saved level's freestanding portals data. Used by a saved map file to load existing levels. Called by the Load() method.
- Portal LoadFreestandingPortal ( Dictionary item ):
Load a single freestanding portals data. Used by a saved map file to load existing levels. Called by the Load() method.
- Dictionary SaveEnvironment ( ):
Save the environment into the save file format and return it as a Dictionary. Called by the Save() method.
- void LoadEnvironment ( Dictionary data ):
Load a saved level's environment data. Used by a saved map file to load existing levels. Called by the Load() method.
- void UpdateFloorRT ( Vector2 size ):
Called by Resize() to update the FloorRT viewport.
- void ToggleLighting ( bool value ):
Toggle the lighting visibility.
- Dictionary Deserialize ( String text ):
Load instances of placed assets in prefab data format and return it as a Dictionary with Node2D key - int value pairs, the int being its SelectableType.
- Rect2 GetSelectionRect ( Dictionary things ):
Measure and return the Rect2 that would enclose a Dictionary of selectable things. The Dictionary is of Node2D key - int value pairs, the int being its SelectableType.