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

rex_board_edge

Plugin, ACE table, Discussion thread
Dependence: rex_board

Introduction
Maintain edges on a board.

Usage
Addressing the edge
There are 3 ways to address a edge
  • Two pairs of logic position XY : ( LX0, LY0 ) - ( LX1, LY1 )
  • Clamped by two neighbor chess : chess_uid0 - chess_uid1
  • Around a chess : chess , direction
One logical position could have one edge.
Create edge
To create edge, call one of these actions. It will create edge instance, set the position, and set angle face to original chess.
  • Action:Create edge between points
  • Action:Create edge between chess
  • Action:Create edge around chess
Older edge will be kicked out of logical position by this new created edge if there are at the same logical position.
Pick edges
To pick edges, call one of these conditions or actions
  • Condition:Pick all edges, Action:Pick all edges
  • Condition:Pick edge between points, Action:Pick edge between points
  • Condition:Pick edges between chess, Action:Pick edges between chess
  • Condition:Pick edges around chess, Action:Pick edges around chess
  • Condition:Pick edges clamped by chess, Action:Pick edges clamped by chess
Remove edges
Call "Action:Remove edges" to remove edges from the board.
Or call "Action:Destroy edges" to remove edges from the board and destroy these instances.
Move edge
To move edge, call one of these actions
  • Action:Move edge between points
  • Action:Move edge between chess
  • Action:Move edge around chess
It will move the logical position of a edge, bit it will not change the physical position and angle of this edge instance.
Has any edge
These conditions are used to check if there is any edge.
  • Condition:Has edge between points
  • Condition:Has edge between chess
  • Condition:Has edges around chess
These will not pick edge instances, only do checking.
Get UID of edge instance
These expression could get the UID of edge instance.
  • Expression:LXY2EdgeUID : parameters are LX0, LY0, LX1, LY1
  • Expression:ChessUID2EdgeUID : parameters are chess_uid0, chess_uid1
  • Expression:ChessDIR2EdgeUID : parameters are chess_uid, direction
Return (-1) if there is no edge found.
Get physics position and angle
Sample capx
"
Expression:EdgeUID2PX", "Expression:EdgeUID2PY", "Expression:EdgeUID2PA" could get physics position and angle from edge UID. Since "Action:Move edge" only move logical position, user could use them to move the physics position and angle manually.
Get edge count around a chess
"Expression:ChessUID2EdgeCount" could get edge count around a chess. Return (-1) if this chess is not in a board.
Kicked edge
A edge will be kicked after edge created or edge moved , since each logical position only could have one edge.
"Condition:On edge kicked" will be triggered when edge kicking, to pick kicked edge.
Mostly, the kicking should not happened, so that this condition might be used for debugging during development stage.
Setup board object
Call "Action:Setup" to setup the target board which edges placed, if there are more then one board object in project.
And one board could have more then one edge objects to be connected.

Co-work with rex_grid_move behavior
Sample capx
图片
Under "Condition:On get solid" (rex_grid_move behavior) event, check if there has an edge between source tile and destination tile by "Condition:Has edges around chess" (rex_board_edge plugin). The parameters of this condition are chess object and direction by "Expression:Direction" (rex_grid_move behavior). Then set the move-able by "Action:Set move-able" (rex_grid_move behavior).
Co-work with rex_slg_movement plugin
Sample capx
图片
First, set "Cache cost" to "No" at properties table, since the cost of tile might be different if moving from different direction.
Under "Condition:On cost" (rex_slg_movement plugin) event, check if there has an edge between previous tile and target tile by "Condition:Has edge between chess" (rex_board_edge plugin). The parameters of this condition are chess_uid0 and chess_uid1 by "Expression:PreTileUID" and "Expression:TileUID" (rex_slg_movement plugin). Then set the cost by "Action:Set cost" (rex_slg_movement plugin).

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