Closed john-trovalto closed 3 years ago
Try to set occupiedTest
and blockerTest
to false
in config of PathFinder. Then the path searching won't excluded any tile.
Then customize the cost function, get chess at the curTileXY
position
var chess = board.tileXYZToChess(curTileXY.x, curTileXY.y, tileZ);
or
var chessArray = board.tileXYToChessArray(tileX, tileY);
return cost according to chess (null if no chess there, or a player chess, etc)
Because that a tile position (tileX, tileY, tileZ) only can have a chess (put a chess to an occupied tile position will kick old one out of board). To avoid that, you might set tileZ to an unique number for each chess.
Or set sneak
to true
in config of moveTo behavior, if using it to move chess.
So are you suggesting to put the ball as a chess object not as a shape?
You might add any game object as a chess by board.addChess(gameObject, tileX, tileY, tileZ, align)
. Shape is a kind of game object, too.
@rexrainbow Thanks, I just added the sprite and it is working fine. If I add physics to it, the sprite is not visible in the board. So just wanted to confirm if the physics game object will work or not?
Update: got it working. Can I add physics bounds around the board so that ball object keep within the gameboard?
Board plugin does not have 'bounds' properties, sorry.
@rexrainbow No worries. I managed to add boundaries. Thanks a lot for help.
Hi,
Can we add an object to the board which can't be block shape and could be consider in path finding?
For example, consider an example of football game. Chess will be the players, referee will be the block object and the ball will be a object which will be overlapped by the players.
Any assistance you can provide would be greatly appreciated.