diff --git a/src/scenes/HuntingScene.js b/src/scenes/HuntingScene.js index 4a53e76..3ca92ac 100644 --- a/src/scenes/HuntingScene.js +++ b/src/scenes/HuntingScene.js @@ -14,6 +14,7 @@ export default class HuntingScene extends Phaser.Scene { this.crosshairY = 300; this.crosshairSpeed = 5; this.crosshairShakeAmount = 2; // Pixels of shake + this.crosshairShakeTime = 0; // Timer for smooth shake oscillation this.useKeyboard = false; // Toggle between mouse and keyboard } @@ -48,9 +49,10 @@ export default class HuntingScene extends Phaser.Scene { this.updateCrosshairMouse(); } - // Update crosshair sprite position with shake - const shakeX = (Math.random() - 0.5) * this.crosshairShakeAmount * 2; - const shakeY = (Math.random() - 0.5) * this.crosshairShakeAmount * 2; + // Update crosshair sprite position with smooth shake + this.crosshairShakeTime += 0.15; // Increment for smooth oscillation + const shakeX = Math.sin(this.crosshairShakeTime * 3) * this.crosshairShakeAmount; + const shakeY = Math.cos(this.crosshairShakeTime * 2.5) * this.crosshairShakeAmount; this.crosshair.setPosition(this.crosshairX + shakeX, this.crosshairY + shakeY); // Update harpoons