rex_grid_move
Introduction
This is an application of board-series. It could move chess to target, or neighbor tile on an orthogonal or isometric, or hexagonal board object.
This is an application of board-series. It could move chess to target, or neighbor tile on an orthogonal or isometric, or hexagonal board object.
Use
- "Action:Move to neighbor", to move chess to neighbor logically and physically, or
- "Action:Move to chess", Action:Move to chess by UID to move chess to target chess/tile, or
- "Action:Move to LXY", Action:Move to offset to move to the specific logical position.
Moving accepted or rejected
A chess could NOT move (i.e. moving rejected) to the target in these rules:
"Condition:On moving rejected" will be triggered if moving rejected by a "solid" target, and the blocker (solid chess, or occupied chess) could be get by "Expression:BlockerUID".
A chess could NOT move (i.e. moving rejected) to the target in these rules:
- The target has no tile (z=0)
- The target's logical position (x,y,z) had been occupied
- The chess at target logical position (x,y) had an enable "solid" behavior
- Return "solid" at custom solid request event (see next section)
"Condition:On moving rejected" will be triggered if moving rejected by a "solid" target, and the blocker (solid chess, or occupied chess) could be get by "Expression:BlockerUID".
"Action:Move to neighbor" or other moving actions -> "Condition:On moving accepted", or
"Action:Move to neighbor" or other moving actions -> "Condition:On moving rejected"
These expressions could be used under "Condition:On moving accepted" or "Condition:On moving rejected".
Source logical position: ( Expression:SourceLX , Expression:SourceLY , Expression:SourceLZ )
Destination logical position: ( Expression:DestinationLX , Expression:DestinationLY , Expression:DestinationLZ )
Moving direction: Expression:Direction , it only valid if chess moves to neighbor.
These expressions could only be used under "Condition:On moving accepted"
Destination physical position: ( Expression:TargetX , Expression:TargetY )
These expressions could only be used under "Condition:On moving rejected".
Blocked chess uid : Expression:BlockerUID
Custom solid
Sample capx
User might want to control the move-able (i.e. not solid) at event sheet manually.
When chess try to move to the target, "Condition:On get solid" will be triggered to ask if the target tile "is solid".
To answer this question, user could pick target tile by "Condition:Pick chess at Logic X,Y,Z" at rex_board object with these parameters
Sample capx
User might want to control the move-able (i.e. not solid) at event sheet manually.
When chess try to move to the target, "Condition:On get solid" will be triggered to ask if the target tile "is solid".
To answer this question, user could pick target tile by "Condition:Pick chess at Logic X,Y,Z" at rex_board object with these parameters
Source logical position: ( Expression:SourceLX , Expression:SourceLY , Expression:SourceLZ )
Destination logical position: ( Expression:DestinationLX , Expression:DestinationLY , Expression:DestinationLZ )
Moving direction: Expression:Direction , it only valid if chess moves to neighbor.
Then call "Action:Set solid", or "Action:Set move-able" to answer this question after some calculation.
The other rules would not be checked if "Action:Set solid", or "Action:Set move-able" is used under "Condition:On get solid", otherwise the other rules would be checked.
On colliding begin
Sample capx
"Condition:On colliding begin" will be triggered if a chess is trying to move to a "solid" tile, or a occupied logical position. This condition will pick the blocker(s) into a (instance) group, so that user need to put a instance group object into project.
The blocking situation will be removed if the blocker had been moved out under this condition. So that the moving request will be accepted.
Sample capx
"Condition:On colliding begin" will be triggered if a chess is trying to move to a "solid" tile, or a occupied logical position. This condition will pick the blocker(s) into a (instance) group, so that user need to put a instance group object into project.
The blocking situation will be removed if the blocker had been moved out under this condition. So that the moving request will be accepted.
Force move
"Force move" could be set to "Yes" in properties table, It will ignore solid checking, and change z-index when logical overlapping.
"Force move" could be set to "Yes" in properties table, It will ignore solid checking, and change z-index when logical overlapping.
Moving behavior
The moving behavior is the same as rex_moveto behavior. When move to target position, "Condition:On hit target position" will be triggered.
The moving behavior is the same as rex_moveto behavior. When move to target position, "Condition:On hit target position" will be triggered.
Move-able testing
"Condition:Can move to neighbor", "Condition:Can move to" is used to test if chess could move to neighbor or target.
"Condition:Can move to neighbor", "Condition:Can move to" is used to test if chess could move to neighbor or target.
Stop
"Action:Stop" will stop physical moving, it will not change the logical position.
"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.
"Action:Swap" could swap and move two chess at the same time. The target chess is indicated by UID.
Continue mode
Set "Continued mode" to "Yes" to move object continuously.
Moving action under "Condition:On hit target position" with "Continued mode" to "Yes", will move forward immediately using remain delta time.
Set "Continued mode" to "Yes" to move object continuously.
Moving action under "Condition:On hit target position" with "Continued mode" to "Yes", will move forward immediately using remain delta time.
Physical moving
It will use built-in MoveTo behavior to move chess physically.
Or set the "MoveTo" to "No" in property table to disable the built-in moving. Designer could maintain physical moving manually.
It will use built-in MoveTo behavior to move chess physically.
Or set the "MoveTo" to "No" in property table to disable the built-in moving. Designer could maintain physical moving manually.
Wrap
Sample capx
Set "Wrap" in properties table to "Yes" in rex_board object will wrap the logical boundary. It will also effect the physical moving when chess moves across wrapped boundary. Only moving to wrapped neighbors will cause physical wrapped moving.
For example, in 10x10 board -
Sample capx
Set "Wrap" in properties table to "Yes" in rex_board object will wrap the logical boundary. It will also effect the physical moving when chess moves across wrapped boundary. Only moving to wrapped neighbors will cause physical wrapped moving.
For example, in 10x10 board -
- When chess moves from (0, 0) to (9, 0) : (0,0) and (9,0) are wrapped neighbors. It will move left until out of board, then wrap to rightmost side, then move left to (9,0).
- When chess moves from (1, 0) to (9, 0) : it will move right to (9,0) directly.
AI
This behavior also provides some actions to move chess to neighbor for AI.
This behavior also provides some actions to move chess to neighbor for AI.
Wander
Sample capx
"Action:Wander" could move chess to a neighbor tile randomly inside a boundary.
The boundary could be set by "Wander range x", "Wander range y" in properties table, or call "Action:Set range x", "Action:Set range y", the chess only could wander from (center position - range), to (center position + range). The center position is the initial position when chess created, it could be reset by
"Action:Reset center position".
The move-able rules are the same as regular moving request like call "Action:Move to neighbor".
Sample capx
"Action:Wander" could move chess to a neighbor tile randomly inside a boundary.
The boundary could be set by "Wander range x", "Wander range y" in properties table, or call "Action:Set range x", "Action:Set range y", the chess only could wander from (center position - range), to (center position + range). The center position is the initial position when chess created, it could be reset by
"Action:Reset center position".
The move-able rules are the same as regular moving request like call "Action:Move to neighbor".
Approach/Depart
Sample capx
"Action:Approach/Depart", or "Action:Approach/Depart chess by UID" could move chess approach to, or depart from one, or more then one target chess.
The move-able rules are the same as regular moving request like call "Action:Move to neighbor".
Sample capx
"Action:Approach/Depart", or "Action:Approach/Depart chess by UID" could move chess approach to, or depart from one, or more then one target chess.
The move-able rules are the same as regular moving request like call "Action:Move to neighbor".