Refactor sizing hitbox charactere
authorgparant <g.parant@thecodingmachine.com>
Mon, 13 Apr 2020 14:53:19 +0000 (16:53 +0200)
committergparant <g.parant@thecodingmachine.com>
Mon, 13 Apr 2020 14:53:19 +0000 (16:53 +0200)
front/src/Phaser/Entity/PlayableCaracter.ts
front/src/Phaser/Player/Player.ts

index 66ddd57999c1d4f32e7b2d0acfcfc7e4dce753d3..3a18ea73b22211cfb6ed9fa7061c3490dde58bbb 100644 (file)
@@ -14,7 +14,8 @@ export class PlayableCaracter extends Phaser.Physics.Arcade.Sprite {
         this.scene.physics.world.enableBody(this);
         this.setImmovable(true);
         this.setCollideWorldBounds(true);
-        this.setSize(32, 32); //edit the hitbox to better match the caracter model
+        this.setSize(16, 16); //edit the hitbox to better match the caracter model
+        this.setOffset(8, 16);
     }
 
     move(x: number, y: number){
index d0169297f7b850bb7ff22259d45b81e0cfd3aaa1..e2d7d6923a76990f5fd3bd1faf3da1f79d826bc5 100644 (file)
@@ -50,8 +50,6 @@ export class Player extends PlayableCaracter implements CurrentGamerInterface, G
 
         //the current player model should be push away by other players to prevent conflict
         this.setImmovable(false);
-        //edit the hitbox to better match the caracter model
-        this.setSize(32, 32);
     }
 
     initAnimation(): void {