Reposition joystick (thx @TabascoEye)

This commit is contained in:
PizZaKatZe 2021-01-22 23:25:39 +01:00
parent c3230bc2b3
commit e713120434

View File

@ -428,6 +428,12 @@ export class GameScene extends ResizableScene implements CenterListener {
mediaManager.setUserInputManager(this.userInputManager);
this.userInputManager = new UserInputManager(this, this.virtualJoystick);
// Listener event to reposition virtual joystick
// whatever place you click in game area
this.input.on('pointerdown', (pointer: { x: number; y: number; }) => {
this.virtualJoystick.x = pointer.x;
this.virtualJoystick.y = pointer.y;
});
//notify game manager can to create currentUser in map
this.createCurrentPlayer();
this.removeAllRemotePlayers(); //cleanup the list of remote players in case the scene was rebooted