From 9b5f566bce6d1088e8edd2a50d9761f54fd02aec Mon Sep 17 00:00:00 2001 From: Thomas Richter Date: Mon, 15 Dec 2025 04:01:38 +0100 Subject: [PATCH] Make crosshair shake smooth with oscillation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Replaced random shake with smooth sine/cosine oscillation - Added crosshairShakeTime variable to track oscillation phase - Uses different frequencies (3x and 2.5x) for natural circular motion - Creates predictable, smooth shake pattern instead of jittery random - More comfortable aiming experience while maintaining difficulty 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 --- src/scenes/HuntingScene.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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