Get forwarding path using Monopoly-like behavior.
Categories > Board > rex_monopoly_movementIntroductionLinksDependenceUsageGet moving pathMain flowFlow chart of getting solid propertyFlow chart of getting next face (moving direction)Flow chart of getting costGet moving cost of a tileFaceMove chess alone pathMove to last tile of path
None
Calls Action:Get forwarding path
to get path
Get Not solid neighbors
Condition:On get solid
,Expression:TileUID
, at LXYZ (Expression:TileLX
, Expression:TileLY
, 0),Action:Set solid
, or Action:Set move-able
Action:Set solid
, or Action:Set move-able
, try get solid property from official solid behavior.Get next tile
if no neighbor found
if 1 neighbor found
if 2 neighbors found
'TileA - TileB - TileC' are a sequence of tiles on the board, Chess move from tileA to tileB in previous step, now tileA and tileC are the neighbors of this step, Chess will try to move to tileC in this step.
if more then 2 neighbors (i.e. forked road) found
try get moving direction (face) from Action:Set face
under Condition:On forked road
trigger Condition:On forked road
pick tile Expression:TileUID
, at LXYZ (Expression:TileLX
, Expression:TileLY
, 0),
get new face by Action:Set face
if new face is NOT assigned in event
If property Forked road
is Forwarding
if forward neighbor found
else, pick a random neighbor, except backward one
If property Forked road
is Random
pick a random neighbor, except backward one
Expression:TotalMovingPoints
is the moving points input parameter of last Action:Get forwarding path
.
if Condition:On get moving cost
is in event sheet
Condition:On get moving cost
Expression:TileUID
, at LXYZ (Expression:TileLX
, Expression:TileLY
, 0),Action:Set cost
else, moving cost = 1
Set moving cost to Expression:STOP
will consume remaining moving cost, to stop at this tile.
Face is the moving direction, each kind of layout (rex_board_squareTx, rex_board_hexTx) has different directions definition.
Initial face is set by properties
Square board
Face to (Square)
Hexagon board
Face to (Hexagon Up-Down)
, orFace to (Hexagon Left-Right)
Or changes face by Action:Set face
at run-time.
Using rex_grid_move behavior to move chess alone path after Action:Get forwarding path
.
Action:Get forwarding path
Add events of C2 function Move to next tile :
Condition:Pop tile
Action:Move to chess
of grid move behaviorsystem condition:Else
)Add events to move to next tile when reached to target tile by Condition:On hit target position
of grid move behavior
Sets propertyForce move
toYes
in grid move behavior, since the move-able (solid) had been determined
by this Action:Get forwarding path
.
Condition:Empty
returns true after all tiles of path are popped by Condition:Pop tile
.
Get the last tile instance by Condition:Pop the last tile
to move to it, or pick this tile by LXYZ (Expression:TargetLX
, Expression:TargetLY
, 0). And the face at last tile is Expression:TargetFaceDir
.