walk on dbl click
This commit is contained in:
parent
6c094b714b
commit
08816ae80f
@ -4,6 +4,10 @@ import type { GameScene } from "../Game/GameScene";
|
|||||||
export class GameSceneUserInputHandler implements UserInputHandlerInterface {
|
export class GameSceneUserInputHandler implements UserInputHandlerInterface {
|
||||||
private gameScene: GameScene;
|
private gameScene: GameScene;
|
||||||
|
|
||||||
|
private lastTime: number = 0;
|
||||||
|
private lastX: number = 0;
|
||||||
|
private lastY: number = 0;
|
||||||
|
|
||||||
constructor(gameScene: GameScene) {
|
constructor(gameScene: GameScene) {
|
||||||
this.gameScene = gameScene;
|
this.gameScene = gameScene;
|
||||||
}
|
}
|
||||||
@ -22,6 +26,8 @@ export class GameSceneUserInputHandler implements UserInputHandlerInterface {
|
|||||||
if (pointer.rightButtonReleased() || pointer.getDuration() > 250) {
|
if (pointer.rightButtonReleased() || pointer.getDuration() > 250) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.lastTime > 0 && pointer.time - this.lastTime < 500 && this.lastX == pointer.x && this.lastY == pointer.y) {
|
||||||
const camera = this.gameScene.getCameraManager().getCamera();
|
const camera = this.gameScene.getCameraManager().getCamera();
|
||||||
const index = this.gameScene
|
const index = this.gameScene
|
||||||
.getGameMap()
|
.getGameMap()
|
||||||
@ -42,6 +48,11 @@ export class GameSceneUserInputHandler implements UserInputHandlerInterface {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.lastTime = pointer.time;
|
||||||
|
this.lastX = pointer.x;
|
||||||
|
this.lastY = pointer.y;
|
||||||
|
}
|
||||||
|
|
||||||
public handlePointerDownEvent(pointer: Phaser.Input.Pointer, gameObjects: Phaser.GameObjects.GameObject[]): void { }
|
public handlePointerDownEvent(pointer: Phaser.Input.Pointer, gameObjects: Phaser.GameObjects.GameObject[]): void { }
|
||||||
|
|
||||||
public handleSpaceKeyUpEvent(event: Event): Event {
|
public handleSpaceKeyUpEvent(event: Event): Event {
|
||||||
|
Loading…
Reference in New Issue
Block a user