made the player pushable by other models
authorkharhamel <oognic@gmail.com>
Sun, 12 Apr 2020 15:13:33 +0000 (17:13 +0200)
committerkharhamel <oognic@gmail.com>
Sun, 12 Apr 2020 15:13:33 +0000 (17:13 +0200)
front/src/Phaser/Game/GameScene.ts
front/src/Phaser/Player/Player.ts

index 545146b17999c2888d48519af01f356831ad548d..dac1f2fc10c61780776aa94a28819960710522e4 100644 (file)
@@ -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 {
index f6079ac835705278b37f10daecfa4088c7b498bf..e4395b3de5c69bfebacb24794a5e65b9c5ba293b 100644 (file)
@@ -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
     }