From: gparant Date: Mon, 13 Apr 2020 14:53:19 +0000 (+0200) Subject: Refactor sizing hitbox charactere X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=ba3f0e07f83b1ccb94e36532c4557743a25f209d;p=libreadventure.git Refactor sizing hitbox charactere --- diff --git a/front/src/Phaser/Entity/PlayableCaracter.ts b/front/src/Phaser/Entity/PlayableCaracter.ts index 66ddd57..3a18ea7 100644 --- a/front/src/Phaser/Entity/PlayableCaracter.ts +++ b/front/src/Phaser/Entity/PlayableCaracter.ts @@ -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){ diff --git a/front/src/Phaser/Player/Player.ts b/front/src/Phaser/Player/Player.ts index d016929..e2d7d69 100644 --- a/front/src/Phaser/Player/Player.ts +++ b/front/src/Phaser/Player/Player.ts @@ -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 {