directional shift for current player when trying to activate entities
This commit is contained in:
parent
72b4438d1e
commit
bf0d2eb412
2 changed files with 19 additions and 2 deletions
|
@ -159,6 +159,19 @@ export abstract class Character extends Container implements OutlineableInterfac
|
|||
return { x: this.x, y: this.y };
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns position based on where player is currently facing
|
||||
* @param shift How far from player should the point of interest be.
|
||||
*/
|
||||
public getDirectionalActivationPosition(shift: number): { x: number, y: number } {
|
||||
switch (this.lastDirection) {
|
||||
case PlayerAnimationDirections.Down: { return { x: this.x, y: this.y + shift }; }
|
||||
case PlayerAnimationDirections.Left: { return { x: this.x - shift, y: this.y }; }
|
||||
case PlayerAnimationDirections.Right: { return { x: this.x + shift, y: this.y }; }
|
||||
case PlayerAnimationDirections.Up: { return { x: this.x, y: this.y - shift }; }
|
||||
}
|
||||
}
|
||||
|
||||
public getObjectToOutline(): Phaser.GameObjects.GameObject {
|
||||
return this.playerNameText;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue