feat: Decrease player speed, add flashlight battery drain and head bob, refine movement acceleration, and adjust camera height.
This commit is contained in:
@@ -9,7 +9,7 @@ export class Player {
|
|||||||
this.colliders = colliders;
|
this.colliders = colliders;
|
||||||
|
|
||||||
// Player stats
|
// Player stats
|
||||||
this.speed = 5.0;
|
this.speed = 3.0; // Slower "Horror" walk speed
|
||||||
this.height = 1.7; // Eyes height
|
this.height = 1.7; // Eyes height
|
||||||
|
|
||||||
// Init controls
|
// Init controls
|
||||||
@@ -32,6 +32,12 @@ export class Player {
|
|||||||
this.direction = new THREE.Vector3();
|
this.direction = new THREE.Vector3();
|
||||||
this.flashlightOn = true; // Started as ON
|
this.flashlightOn = true; // Started as ON
|
||||||
this.battery = 100.0;
|
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.baseDrain = 0.5; // Drain per second at base intensity
|
||||||
|
|
||||||
this.setupInput();
|
this.setupInput();
|
||||||
@@ -128,8 +134,10 @@ export class Player {
|
|||||||
this.direction.x = Number(this.moveRight) - Number(this.moveLeft);
|
this.direction.x = Number(this.moveRight) - Number(this.moveLeft);
|
||||||
this.direction.normalize();
|
this.direction.normalize();
|
||||||
|
|
||||||
if (this.moveForward || this.moveBackward) this.velocity.z -= this.direction.z * 100.0 * dt;
|
const accel = this.speed * 10.0; // Acceleration to reach max speed against friction (assuming friction 10)
|
||||||
if (this.moveLeft || this.moveRight) this.velocity.x -= this.direction.x * 100.0 * dt;
|
|
||||||
|
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
|
// Apply movement
|
||||||
this.controls.moveRight(-this.velocity.x * dt);
|
this.controls.moveRight(-this.velocity.x * dt);
|
||||||
@@ -159,7 +167,7 @@ export class Player {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Keep player on ground
|
// Keep player on ground
|
||||||
playerPos.y = this.height;
|
this.camera.position.y = this.height;
|
||||||
|
|
||||||
// Flashlight flicker effect (subtle) & Battery Logic
|
// Flashlight flicker effect (subtle) & Battery Logic
|
||||||
if (this.flashlight && this.flashlightOn) {
|
if (this.flashlight && this.flashlightOn) {
|
||||||
|
|||||||
Reference in New Issue
Block a user