Skip to content

PatternShape

Extends: Polygon2D

Description

A PatternShape is a Dungeondraft asset instance of what the user sees as an pattern shape from the PatternShapeTool. See Asset Instance.

Properties

Line2D Outline
bool HasOutline
Rect2 GlobalRect
Vector2[] GlobalPolygon

Methods

Dictionary Save ( bool copy = false )
bool IsMouseWithin ( Vector2 mousePos )
PatternShapes GetShapes ( )
int GetLayer ( )
void SetLayer ( int layer )
void SetNewRotation ( float rotation )
void SetOptions ( Texture texture, Color color, float rotation )
void SetPoints ( Vector2[] points, bool outline )
void SetOutline ( Vector2[] points, Texture texture )

Property Descriptions

  • Line2D Outline:
    The visual aspect of the border. Read only. Call SetOutline() to set.

  • bool HasOutline:
    Gets if this shape has a border. Read only.

  • Rect2 GlobalRect:
    The global Rect2 enclosing the shape. DO NOT MODIFY.

  • Vector2[] GlobalPolygon:
    The points of the shape in world space. READ ONLY.

Method Descriptions

  • Dictionary Save ( bool copy = false ):
    Save the PatternShape into the save file format and return it as a Dictionary. The param copy is only used by copy-pasting feature of Dungeondraft. The Load() equivalent resides in the PatternShapes class.




  • void SetLayer ( int layer ):
    Change the layer of the shape.

  • void SetNewRotation ( float rotation ):
    Allows changing of the rotation without affecting the other options.


  • void SetPoints ( Vector2[] points, bool outline ):
    Set the points of this shape or toggle the outline visibility.

  • void SetOutline ( Vector2[] points, Texture texture ):
    Changes the outline points and texture. Called by SetPoints() when outline is enabled.