Rex's plugins for Construct2
  • Home
  • Map
  • Tutorial/Templates
  • News
  • About

rex_boundary

Plugin, ACE table, Discussion thread
Dependence: None

Introduction
Clamp position of object in the boundary, or wrap the position at the other boundary.

Usage
Sample capx
Assign boundaries
There are two kinds of boundary -- horizontal, and vertical. These boundaries could be assign in three ways.
In properties table,
  • Horizontal: "Horizontal" setting to "Yes", and configure the "Left", "Right" bound
  • Vertical: "Vertical" setting to "Yes", and configure the "Top", "Bottom" bound
Or assign these boundaries by "Action:Set horizontal boundary", "Action:Set vertical boundary".
Or assign boundaries related by image points of other object by "Action:Set horizontal boundary to", "Action:Set vertical boundary to".
Clamp
Set "Mode" to "
Clamp" could clamp the
position of object in the boundary.
  • Set "Align" to "Boundaries" could clamp the object according to the boundaries of this object, or
  • Set "Align" to "Origin", to clamp this object according to origin point (i.e. instance's XY position) of this object.
Wrap
Set "Mode" to "Wrap"
. The object which has left out one boundary, will be reappear at the other side.
  • Set "Align" to "Boundaries" will do wrapping until whole object has left out the boundary. This behavior is similar with official wrap behavior.
  • Set "Align" to "Origin" will do wrapping when the origin point of this object has left out the boundary
Mode wrap
Sample capx
Set "Mode" to "Mod wrap"
. The object which has left out one boundary, will be reappear at the other side, with an offset to keep the moving distance.

For example,
if this instance moved out of left bound with offset to -10 pixels, i.e. (left - 10), it would be wrapped to right bound with offset to -10 pixels, i.e. (right - 10).
Property "Align" of this mode only supports "Origin".


Percentage
User could get a value between 0 to 1 mapped from left boundary to right boundary, or top boundary to bottom boundary by "Expression:HorPercent" (left-right) , or "Expression:VerPercent" (top-bottom).
"Expression:HorScale" and "Expression:VerScale" are advance expressions, they will map the percentage value to another value.
This feature might be useful while making a value input interface by scrolling, like the sample capx.
Get position by percentage of boundaries
Sample capx
Get position X/Y from percentage (0-1) of horizontal / vertical boundaries by "Expression:HorPercent2PosX" / "Expression:HorPercent2PosY".

Create a free web site with Weebly
  • Home
  • Map
  • Tutorial/Templates
  • News
  • About