I would like to know how can is use the IgePoint class in my character class? From the example u use it inside ServerNetworkEvent which i do not know where u declare it to retrieve the startTile position. Below is code from the example point to tile
Code: Select all
_onPlayerControlToTile: function (data, clientId) {
if (ige.server.players[clientId]) {
var playerEntity = ige.server.players[clientId],
newPath,
currentPosition = playerEntity._translate,
startTile;
console.log('Path to: ', data , 'From client: ', clientId);
// Calculate the start tile from the current position by using the collision map
// as a tile map (any map will do with the same tileWidth and height).
startTile = playerEntity._parent.pointToTile(currentPosition.toIso());
newPath = ige.server.pathFinder.aStar(ige.server.foregroundMap, startTile, new IgePoint(parseInt(data[0]), parseInt(data[1]), 0), function (tileData, tileX, tileY) {
// If the map tile data is set to 1, don't allow a path along it
// console.log('tileData', tileData);
return tileData !== 1;
}, true, false);
playerEntity
.path.clear()
.path.add(newPath)
.path.start();
}
}
Please advice.
Regards,
Zachz