diff --git a/src/Player.js b/src/Player.js index 6ff698b..800b038 100644 --- a/src/Player.js +++ b/src/Player.js @@ -9,7 +9,7 @@ export class Player { this.colliders = colliders; // Player stats - this.speed = 5.0; + this.speed = 3.0; // Slower "Horror" walk speed this.height = 1.7; // Eyes height // Init controls @@ -32,6 +32,12 @@ export class Player { this.direction = new THREE.Vector3(); this.flashlightOn = true; // Started as ON this.battery = 100.0; + this.battery = 100.0; + this.baseDrain = 0.5; // Drain per second at base intensity + + // Animation + this.headBobTimer = 0; + this.baseDrain = 0.5; // Drain per second at base intensity this.setupInput(); @@ -128,8 +134,10 @@ export class Player { this.direction.x = Number(this.moveRight) - Number(this.moveLeft); this.direction.normalize(); - if (this.moveForward || this.moveBackward) this.velocity.z -= this.direction.z * 100.0 * dt; - if (this.moveLeft || this.moveRight) this.velocity.x -= this.direction.x * 100.0 * dt; + const accel = this.speed * 10.0; // Acceleration to reach max speed against friction (assuming friction 10) + + if (this.moveForward || this.moveBackward) this.velocity.z -= this.direction.z * accel * dt; + if (this.moveLeft || this.moveRight) this.velocity.x -= this.direction.x * accel * dt; // Apply movement this.controls.moveRight(-this.velocity.x * dt); @@ -159,7 +167,7 @@ export class Player { } // Keep player on ground - playerPos.y = this.height; + this.camera.position.y = this.height; // Flashlight flicker effect (subtle) & Battery Logic if (this.flashlight && this.flashlightOn) {