Portal
Extends: Node2D
Description
A Portal is a Dungeondraft asset instance of what the user sees as an portal from the PortalTool. See Asset Instance. All the properties of the Portal should be set before it enters the SceneTree or the visuals will not be reflected.
Properties
float | Radius |
Vector2 | Direction |
Vector2 | Begin |
Vector2 | End |
Sprite | Sprite |
LightOccluder2D | LightOccluder |
Texture | Texture |
bool | Closed |
bool | Flip |
int | WallID |
float | WallDistance |
int | WallPointIndex |
bool | IsFreestanding |
Rect2 | Rect |
bool | isHighlighted |
bool | isSelected |
Methods
Dictionary | Save ( bool copy = false ) |
void | Load ( Dictionary data ) |
Dictionary | Export ( ) |
bool | Overlaps ( Vector2 position, float widthSquared ) |
bool | IsMouseWithin ( ) |
bool | IsPointWithin ( Vector2 point ) |
void | Highlight ( bool value ) |
void | Select ( bool bvalue ) |
void | SetTexture ( Texture texture ) |
void | SetClosed ( bool value ) |
Property Descriptions
- float Radius:
Gets or sets the radius.
- Vector2 Direction:
Gets or sets the facing.
- Vector2 Begin:
Gets the start position of the Portal in world space.
- Vector2 End:
Gets the end position of the Portal in world space.
- Sprite Sprite:
Gets the Sprite that visually displays the Portal.
- LightOccluder2D LightOccluder:
Gets the LightOccluder2D that blocks light for this Portal.
- Texture Texture:
Gets or sets the texture.
- bool Closed:
Toggles whether this Portal blocks light.
- bool Flip:
Toggles the orientation.
- int WallID:
The NodeID of the wall associated with this Portal. Is -1 if the Portal is freestanding.
- float WallDistance:
Gets the distance along the wall this Portal is placed just after the WallPointIndex position.
- int WallPointIndex:
Gets the index of the point along the wall preceding this Portal.
- bool IsFreestanding:
Checks if the Portal is freestanding.
- Rect2 Rect:
This property is set by Dungeondraft to determine the size of the box around the Portal when selected. Automatically updated.
- bool isHighlighted:
Determines if the Portal is highlighted. Read only, call Highlight() instead to set.
- bool isSelected:
Determines if the Portal is visually selected. Read only, call Select() instead to set.
Method Descriptions
- Dictionary Save ( bool copy = false ):
Save the Portal into the save file format and return it as a Dictionary. The param copy is only used by copy-pasting feature of Dungeondraft.
- void Load ( Dictionary data ):
Load a saved Portal data. Used by a saved map file to load existing portals.
- Dictionary Export ( ):
Export a VTT friendly JSON table in Dictionary format about this Portal.
- bool Overlaps ( Vector2 position, float widthSquared ):
Checks if the position overlaps the Portal giving the squared widths.
- bool IsMouseWithin ( ):
Checks if the mouse cursor is over the Portal. Only used by the SelectTool.
- bool IsPointWithin ( Vector2 point ):
Checks if the point is over the Portal. Only used by the SelectTool.
- void Select ( bool bvalue ):
Visually select the Portal. Does not mean it is selected in the SelectTool.
- void SetTexture ( Texture texture ):
Change the Portal to a new Texture.