From d1106d757daba6b0e85a1ac3c22e97bacb6f1d7c Mon Sep 17 00:00:00 2001 From: kharhamel Date: Sun, 12 Apr 2020 17:13:33 +0200 Subject: [PATCH] made the player pushable by other models --- front/src/Phaser/Game/GameScene.ts | 4 ++++ front/src/Phaser/Player/Player.ts | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/front/src/Phaser/Game/GameScene.ts b/front/src/Phaser/Game/GameScene.ts index 545146b1..dac1f2fc 100644 --- a/front/src/Phaser/Game/GameScene.ts +++ b/front/src/Phaser/Game/GameScene.ts @@ -103,6 +103,10 @@ export class GameScene extends Phaser.Scene implements GameSceneInterface{ let eventList = this.userInputManager.getEventListForGameTick(); this.player.move(eventList); + + this.otherPlayers.getChildren().forEach((otherPlayer: NonPlayer) => { + otherPlayer.setVelocity(20, 5); + }) } sharedUserPosition(data: []): void { diff --git a/front/src/Phaser/Player/Player.ts b/front/src/Phaser/Player/Player.ts index f6079ac8..e4395b3d 100644 --- a/front/src/Phaser/Player/Player.ts +++ b/front/src/Phaser/Player/Player.ts @@ -8,7 +8,7 @@ export class Player extends PlayableCaracter{ constructor(scene: Phaser.Scene, x: number, y: number) { super(scene, x, y, Textures.Player, 26); - this.setImmovable(false); + this.setImmovable(false); //the current player model should be push away by other players to prevent conflict this.setSize(32, 32); //edit the hitbox to better match the caracter model }