rex_monopoly_movement
Introduction
This is an application of board-series. It could get forwarding path on an orthogonal or isometric, or hexagonal board object, used in Monopoly-like game usually.
This is an application of board-series. It could get forwarding path on an orthogonal or isometric, or hexagonal board object, used in Monopoly-like game usually.
Concept
The concept of this behavior is similar to rex_slg_movement plugin.
This behavior could find a moving path which move chess forward until not enough moving point. Like rex_slg_movement plugin, each tile has a moving cost.
The concept of this behavior is similar to rex_slg_movement plugin.
This behavior could find a moving path which move chess forward until not enough moving point. Like rex_slg_movement plugin, each tile has a moving cost.
Steps of moving forward
1. Initialize
Assign an initial face direction by "Face to (Square)" , or "Face to (Hexagon Up-Down)", "Face to (Hexagon Left-Right)" at properties table according type of board layout, or by "Action:Set face" at run-time. The direction could be got by expressions of board layout.
Assign an initial face direction by "Face to (Square)" , or "Face to (Hexagon Up-Down)", "Face to (Hexagon Left-Right)" at properties table according type of board layout, or by "Action:Set face" at run-time. The direction could be got by expressions of board layout.
2. Moving start
Call "Action:Get forwarding path" to get moving path, the result is tile instances. Moving points could be read back by "Expression:TotalMovingPoints".
The moving cost of each tile could be got by "Condition:On get moving cost" - "Action:Set cost" discussed at later section, the default moving cost is 1.
Call "Action:Get forwarding path" to get moving path, the result is tile instances. Moving points could be read back by "Expression:TotalMovingPoints".
The moving cost of each tile could be got by "Condition:On get moving cost" - "Action:Set cost" discussed at later section, the default moving cost is 1.
3. Moving
After got tile instances of moving path, use "Condition:Pop tile" to pop one tile instance in order. The chess could move to target tile by rex_grid_move behavior.
Or get the target tile i.e. the last one tile of this moving path by "Condition:Pop the last tile", or picked by "Expression:TargetLX", "Expression:TargetLY".
After got tile instances of moving path, use "Condition:Pop tile" to pop one tile instance in order. The chess could move to target tile by rex_grid_move behavior.
Or get the target tile i.e. the last one tile of this moving path by "Condition:Pop the last tile", or picked by "Expression:TargetLX", "Expression:TargetLY".
4. Moving finished
"Condition:Empty" returns true while all tiles in current moving path had been popped, i.e. the moving is finished. Set the face direction to "Expression:TargetFaceDir" by "Action:Set face".
"Condition:Empty" returns true while all tiles in current moving path had been popped, i.e. the moving is finished. Set the face direction to "Expression:TargetFaceDir" by "Action:Set face".
Moving cost
The moving cost of each tile is 1 by default. User could assign moving cost for each tile under "Condition:On get moving cost".
Under this condition, use "Expression:TileUID", or "Expression:TileLX", "Expression:TileLY" to pick target tile/chess instance, the moving cost could be marked at private variable of this picked instance. Call "Action:Set cost" to return moving cost.
The moving cost of each tile is 1 by default. User could assign moving cost for each tile under "Condition:On get moving cost".
Under this condition, use "Expression:TileUID", or "Expression:TileLX", "Expression:TileLY" to pick target tile/chess instance, the moving cost could be marked at private variable of this picked instance. Call "Action:Set cost" to return moving cost.
- If no "Action:Set cost" had been called, or no "Condition:On get moving cost" in event sheet, the default moving cost will be 1.
- Return "Expression:STOP" will force the moving path stopped in this tile. i.e. this tile would consume all remainder moving points. The value of "Expression:STOP" is (-1).
- Return 0, i.e. moving cost to 0, is for the tile which could not be stayed.
Solid
The chess could not cross "solid" tiles. The "solid" could be assign by "Condition:On get solid" - "Action:Set move-able", or put official solid behavior in tile object.
The chess could not cross "solid" tiles. The "solid" could be assign by "Condition:On get solid" - "Action:Set move-able", or put official solid behavior in tile object.
Custom solid
User could assign solid property for each tile at run-time under "Condition:On get solid".
Under this condition, use "Expression:TileUID", or "Expression:TileLX", "Expression:TileLY" to pick target tile/chess instance, then return solid property by "Action:Set solid", "Action:Set solid by number", or "Action:Set move-able", "Action:Set move-able by number". Move-able is equal to NOT solid,
User could assign solid property for each tile at run-time under "Condition:On get solid".
Under this condition, use "Expression:TileUID", or "Expression:TileLX", "Expression:TileLY" to pick target tile/chess instance, then return solid property by "Action:Set solid", "Action:Set solid by number", or "Action:Set move-able", "Action:Set move-able by number". Move-able is equal to NOT solid,
Forked road
This behavior will determine the moving direction while the chess moved at a forked road. There are two default modes set at properties table, or by "Action:Set direction selection" at run-time.
This behavior will determine the moving direction while the chess moved at a forked road. There are two default modes set at properties table, or by "Action:Set direction selection" at run-time.
- Forwarding: chess will try to move forwarding first
- Random: chess will pick a random direction
Custom direction
User could assign direction for each forked tile by "Condition:On forked road".
Under this condition, use "Expression:TileUID", or "Expression:TileLX", "Expression:TileLY" to pick target tile/chess instance, then return direction by"Action:Set face".
User could assign direction for each forked tile by "Condition:On forked road".
Under this condition, use "Expression:TileUID", or "Expression:TileLX", "Expression:TileLY" to pick target tile/chess instance, then return direction by"Action:Set face".