Make crosshair shake smooth with oscillation
- 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 <noreply@anthropic.com>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user