refactor: Reduce player size by 50% to improve pixel collision

This commit is contained in:
Kacper Kostka (aider)
2025-04-05 18:49:31 +02:00
parent d2ab5094ab
commit bb1e25e753
2 changed files with 6 additions and 6 deletions

View File

@@ -2,8 +2,8 @@
class Player extends Entity {
constructor(x, y, options = {}) {
super(ENTITY_TYPES.PLAYER, x, y, {
width: 6, // Narrower collision box to match sprite
height: 12, // Shorter collision box to match sprite
width: 3, // 50% smaller collision box width
height: 6, // 50% smaller collision box height
...options
});
@@ -128,9 +128,9 @@ class Player extends Entity {
ctx.save();
ctx.translate(screenX, screenY);
// Use smaller dimensions for the sprite
const spriteDisplayWidth = 24 * (PIXEL_SIZE / 2); // Smaller sprite (was 32)
const spriteDisplayHeight = 24 * (PIXEL_SIZE / 2); // Smaller sprite (was 32)
// Use 50% smaller dimensions for the sprite
const spriteDisplayWidth = 12 * (PIXEL_SIZE / 2); // 50% smaller sprite
const spriteDisplayHeight = 12 * (PIXEL_SIZE / 2); // 50% smaller sprite
// Flip horizontally based on direction
if (this.direction < 0) {