Skip to content

Add zoom sound effect - #15

Open
wannerdev wants to merge 2 commits into
mainfrom
feature/zoom-sound-effect
Open

Add zoom sound effect#15
wannerdev wants to merge 2 commits into
mainfrom
feature/zoom-sound-effect

Conversation

@wannerdev

Copy link
Copy Markdown
Owner

Description

Adds audio feedback when players zoom in or out using mouse wheel or pinch-to-zoom gestures.

Changes

  • Added SolarSystemAssets import to gameplay module
  • Implemented zoom sound playback in camera_zoom function (mouse wheel)
  • Added zoom sound to camera_pinch_zoom function (mobile pinch-to-zoom)
  • Sound plays only when zoom level actually changes (prevents spam)
  • Works for both desktop (mouse wheel) and mobile (pinch gesture)
  • Using warning_sound as placeholder (can be replaced with custom zoom sound)
  • Added level change detection to prevent unnecessary sound playback

Sound Behavior

  • Mouse Wheel: Sound plays when scrolling changes zoom level
  • Pinch Zoom: Sound plays when pinch gesture changes zoom level
  • No Spam: Only plays when level actually changes (not on every scroll event)
  • Threshold: Pinch zoom has 5.0 pixel threshold to avoid jitter sounds
  • Stepped Zoom: Works with existing 5-level zoom system

Zoom Levels

The game has 5 predefined zoom levels:

  1. 0.1 (most zoomed out)
  2. 0.15
  3. 0.25 (default)
  4. 0.5
  5. 0.75 (most zoomed in)

Benefits

  • Provides immediate audio feedback for zoom actions
  • Helps players understand zoom is working
  • Enhances game feel and responsiveness
  • Works on both desktop and mobile
  • Prevents audio spam with level change detection
  • Makes zoom mechanic more discoverable

Technical Details

  • Stores old zoom level before processing input
  • Compares old vs new level after input
  • Only spawns audio entity if levels differ
  • Uses PlaybackSettings::DESPAWN for automatic cleanup
  • Integrated into existing zoom systems
  • No performance impact (sound only on level change)

Audio Asset

  • Currently using warning_sound (beepx3.wav) as placeholder
  • Can be easily replaced with custom zoom sound:
    • Short "whoosh" or "click" sound recommended
    • Should be subtle and not distracting
    • Duration: 0.1-0.3 seconds ideal

Testing

  • Use mouse wheel to zoom in/out and verify sound plays
  • Use pinch gesture on mobile and verify sound plays
  • Scroll rapidly and verify sound doesn't spam
  • Check that sound only plays when zoom level changes
  • Verify works at all zoom levels (1-5)
  • Test that pinch threshold prevents jitter sounds

Related Issue

Fixes: Sound Effects - Add zoom sound effect

Suna AI Agent and others added 2 commits October 19, 2025 07:18
- Added SolarSystemAssets import to gameplay module
- Implemented zoom sound playback in camera_zoom function
- Added zoom sound to camera_pinch_zoom function (mobile)
- Sound plays only when zoom level actually changes
- Works for both mouse wheel and pinch-to-zoom gestures
- Using warning_sound as placeholder (can be replaced)
- Provides audio feedback for zoom actions
- Prevents sound spam by checking level change
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant