Categories > Board > rex_grid_move

Introduction

Moves chess to target position, or neighbor tile.

Links


Categories > Board > rex_grid_moveIntroductionLinksDependenceUsageMoving startOverlapping testMoving accepted or rejectedFlow chart of Condition:On colliding beginFlow chart of Condition:On get solidMovingMove to logical positionMove to physical positionContinue modeStopSwapWrapAIWanderApproach/Depart

Dependence

None

Usage

Moving action Logical position Physical position MoveTo behavior Move-able test Overlapping testNoIs logical overlappingYesYesNoNoYesNoYesYesNoReaching targetSet logical positionProperty: MoveTo+Every tick- Set physical positionCustom moving behavior----( Expression:TargetX, Expression:TargetY )+Condition:On hit target positionTargetLXYZis inside boardProperty: Force moveCan not move----Condition:On moving rejectedTarget LXYZis empty, andis Not solid----Custom solidCan move----+Condition:On moving acceptedTarget LXYZis empty+Condition:On colliding beginStart moving:---Action:Move to neighborAction:Move to LXY...Move from(Expression:SourceLX, Expression:SourceLY, Expression:SourceLZ)to(Expression:DestinationLX, Expression:DestinationLY, Expression:DestinationLZ)direction: Expression:Direction

Moving start

Sample capx

Chess will try to move

Overlapping test

Plugin first checks the target LXYZ is empty or not.

Moving accepted or rejected

Next, it will test if chess could move to target LXYZ or not, when

  1. target LXYZ is inside board, and

  2. property Force move is Yes , otherwise (Force move is No),

    1. Target LXYZ is empty

    2. Target LXY does not have solid chess

      • Chess has official solid behavior, or

      • Has custom solid property set by Condition:On get solid (Sample capx)

        • Return solid result by Action:Set move-able or Condition:On get solid

After testing,

Flow chart of Condition:On colliding begin

+Condition:On colliding begin+Instance group condition:Pick instancesActions to move collided chess

Flow chart of Condition:On get solid

Pick chess or tilePick chess or tile----Board condition:Pick chess at Logic X,Y,ZSource LXYZ---( Expression:SourceLX , Expression:SourceLY , Expression:SourceLZ )Destination LXYZ---( Expression:DestinationLX , Expression:DestinationLY , Expression:DestinationLZ )+Condition:On get solidReturn result----Action:Set move-ableAction:Set solid

Moving

Move to logical position

Chess will move to target logical position immediately if moving accepted.

Z-index will be changed when logical overlapping in Force move mode.

Move to physical position

Chess will move from current physical position to target physical position ( Expression:TargetX , Expression:TargetY ) by rex_moveto-like behavior if property MoveTo is set to Yes. Condition:On hit target position will be triggered when moving to target position.

Set property MoveTo to No to turn off built-in moving behavior.

Continue mode

Set Continued mode to Yes to move object continuously. Moving action under Condition:On hit target position will move forward immediately using remaining time of current tick.

Stop

Action:Stop will stop physical moving, it will not change the logical position.

Swap

Action:Swap could swap and move two chess at the same time. The target chess is indicated by UID.


Wrap

Sample capx Wrap mode is enabled by Wrap property in rex_board object, which will wrap the logical boundaries. It will also effect the physical moving when chess moves across wrapped boundaries.

For example, in 10x10 board -


AI

This behavior also provides some actions to move chess to neighbor for AI.

Wander

Sample capx Action:Wander could move to a neighbor tile randomly inside a boundary,

The center position is

The boundary is set by

Approach/Depart

Sample capx

Action:Approach/Depart, or Action:Approach/Depart chess by UID could move chess approach to,

or depart from target chess.