Skip to content

Commit

Permalink
fix: Fix issue with not being able to select arcadian headgear
Browse files Browse the repository at this point in the history
  • Loading branch information
johnedvard committed Aug 28, 2022
1 parent 852dbd4 commit 5dbff24
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Player.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export class Player {
sprite = { render: () => {}, x: 0, y: 0 }; // draw sprite on pointmass position
headSprite = { render: () => {}, x: 0, y: 0 }; // From Arcadian API
hasWon = false;
headImg = getSelectedArcadian().img || { width: 0, height: 0 };
headImg;
headOffset = { x: 10, y: 38 };
isLeft = false;
isRopeCut = false;
Expand All @@ -25,6 +25,7 @@ export class Player {
const ropeLength = levelData.r;
const startX = levelData.p.x;
const startY = levelData.p.y;
this.headImg = getSelectedArcadian().img || { width: 0, height: 0 };
this.createRope({ startX, startY, ropeLength });
this.createSprite();
this.createHeadSprite(this.headImg);
Expand Down Expand Up @@ -62,7 +63,7 @@ export class Player {
};
}
createHeadSprite(img) {
if (!img.width || img.height) return;
if (!img.width || !img.height) return;
const scale = this.scale / 2;
let scaleX = scale;
if (this.isLeft) scaleX = scaleX * -1;
Expand Down

0 comments on commit 5dbff24

Please sign in to comment.