Skip to content

Commit 2b859f9

Browse files
committed
fix: adjust player light offset for normal and crouched state
1 parent e5cc43e commit 2b859f9

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

src/GameScene.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,10 @@ const REFILL_BODY_SIZE = Math.max(4, Math.round(WORLD.tile * 0.5));
112112
const REFILL_CONSUME_FREEZE_TIME = 0.05;
113113
const DEATH_SHAKE_DURATION_MS = 120;
114114
const DEATH_SHAKE_INTENSITY = 0.0026;
115+
const PLAYER_LIGHT_OFFSET_Y = {
116+
normal: -8,
117+
crouched: -3,
118+
} as const;
115119
const SPAWN_WIPE_HEIGHT = VIEWPORT.height + SPAWN_WIPE_VISUALS.edgeOverscan * 2;
116120
const DEBUG_HITBOX_COLOR = 0xff0000;
117121
const DEBUG_HURTBOX_COLOR = 0x00ff00;
@@ -1446,10 +1450,13 @@ export class GameScene extends Phaser.Scene {
14461450
}
14471451

14481452
private renderLighting(snapshot: ReturnType<Player["getSnapshot"]>): void {
1453+
const playerLightOffsetY = snapshot.isCrouched
1454+
? PLAYER_LIGHT_OFFSET_Y.crouched
1455+
: PLAYER_LIGHT_OFFSET_Y.normal;
14491456
const lights: LightingSource[] = [
14501457
{
1451-
x: snapshot.centerX,
1452-
y: snapshot.centerY - 2,
1458+
x: snapshot.x,
1459+
y: snapshot.y + playerLightOffsetY,
14531460
radius: 48,
14541461
color: COLORS.dust,
14551462
intensity: 0.12,

0 commit comments

Comments
 (0)