player following the path wip
This commit is contained in:
parent
77ee39110f
commit
e557e8ea72
5 changed files with 108 additions and 41 deletions
|
@ -130,6 +130,14 @@ export class GameMap {
|
|||
return grid;
|
||||
}
|
||||
|
||||
public getTileDimensions(): { width: number; height: number } {
|
||||
return { width: this.map.tilewidth, height: this.map.tileheight };
|
||||
}
|
||||
|
||||
public getTileIndexAt(x: number, y: number): { x: number; y: number } {
|
||||
return { x: Math.floor(x / this.map.tilewidth), y: Math.floor(y / this.map.tileheight) };
|
||||
}
|
||||
|
||||
private getLayersByKey(key: number): Array<ITiledMapLayer> {
|
||||
return this.flatLayers.filter((flatLayer) => flatLayer.type === "tilelayer" && flatLayer.data[key] !== 0);
|
||||
}
|
||||
|
|
|
@ -570,7 +570,6 @@ export class GameScene extends DirtyScene {
|
|||
);
|
||||
|
||||
this.pathfindingManager = new PathfindingManager(this, this.gameMap.getCollisionsGrid());
|
||||
this.pathfindingManager.findPath({ x: 1, y: 3 }, { x: 29, y: 3 });
|
||||
biggestAvailableAreaStore.recompute();
|
||||
this.cameraManager.startFollowPlayer(this.CurrentPlayer);
|
||||
|
||||
|
@ -2174,4 +2173,16 @@ ${escapedMessage}
|
|||
this.scene.stop(this.scene.key);
|
||||
this.scene.remove(this.scene.key);
|
||||
}
|
||||
|
||||
public getGameMap(): GameMap {
|
||||
return this.gameMap;
|
||||
}
|
||||
|
||||
public getCameraManager(): CameraManager {
|
||||
return this.cameraManager;
|
||||
}
|
||||
|
||||
public getPathfindingManager(): PathfindingManager {
|
||||
return this.pathfindingManager;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue