diff --git a/js/entities/player.js b/js/entities/player.js index c04dd76..82d60c4 100644 --- a/js/entities/player.js +++ b/js/entities/player.js @@ -139,12 +139,13 @@ class Player extends Entity { // Draw the correct sprite frame // Center the sprite on the entity position, with y-offset to align feet with collision box + // Stretch the sprite vertically to match the collision box height ctx.drawImage( this.sprite, this.currentFrame * this.frameWidth, 0, this.frameWidth, this.frameHeight, - -spriteDisplayWidth / 2, -spriteDisplayHeight / 2 - 2, // Adjusted y-offset to align with collision box - spriteDisplayWidth, spriteDisplayHeight + -spriteDisplayWidth / 2, -spriteDisplayHeight / 2, // Remove the negative offset that caused levitation + spriteDisplayWidth, spriteDisplayHeight * 1.2 // Stretch sprite vertically by 20% to match collision box ); ctx.restore(); @@ -167,9 +168,9 @@ class Player extends Entity { ctx.lineWidth = 1; ctx.strokeRect( screenX - spriteDisplayWidth / 2, - screenY - spriteDisplayHeight / 2 - 2, // Match the sprite drawing offset + screenY - spriteDisplayHeight / 2, // Match the updated sprite drawing position spriteDisplayWidth, - spriteDisplayHeight + spriteDisplayHeight * 1.2 // Match the stretched sprite height ); // Draw a dot at the entity's exact position