From de5df111936ab01e4c260505d71bced66d0b81d3 Mon Sep 17 00:00:00 2001 From: Mal Date: Thu, 28 Sep 2023 12:04:04 +0200 Subject: [PATCH] Mr. Croc is less fat now --- js/MrCroc.js | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/js/MrCroc.js b/js/MrCroc.js index fd7c689..2c6a613 100644 --- a/js/MrCroc.js +++ b/js/MrCroc.js @@ -23,4 +23,38 @@ export default class MrCroc extends Movable this.playAnimation('WALK_LEFT', timestamp); super.moveLeft(delta); } -} \ No newline at end of file + + getPositionFootLeft() { + const position = super.getPositionFootLeft(); + position.x += 10; + + return position; + } + + getPositionFootRight() { + const position = super.getPositionFootRight(); + position.x -= 10; + + return position; + } + + getPositionHeadLeft() { + const position = super.getPositionHeadLeft(); + + if (this.currentAnimation === 'WALK_RIGHT') { + position.x += 10; + } + + return position; + } + + getPositionHeadRight() { + const position = super.getPositionHeadRight(); + + if (this.currentAnimation === 'WALK_LEFT') { + position.x += 10; + } + + return position; + } +}