Skip to content

Add charging bow visualization for long touch - #18

Open
wannerdev wants to merge 1 commit into
mainfrom
feature/charging-bow-visualization
Open

Add charging bow visualization for long touch#18
wannerdev wants to merge 1 commit into
mainfrom
feature/charging-bow-visualization

Conversation

@wannerdev

Copy link
Copy Markdown
Owner

Description

Adds a visual charging effect that appears behind Earth when holding touch on mobile, showing the force magnitude building up like drawing a bow.

Changes

  • Created new charging_bow module in effects
  • Implemented draw_charging_bow system
  • Shows expanding arc behind Earth as touch is held
  • Arc grows from 8.0 to 14.0 radius over 1 second (matches force cap)
  • Color transitions from orange to bright yellow as it charges
  • Pulsing energy particles at bow tips when fully charged (>90%)
  • Multiple arc layers for depth effect
  • Integrated into effects plugin system

Visual Effect Details

  • Trigger: When LaunchArmed is true and touch is being held
  • Position: Behind Earth (180-degree arc)
  • Radius: Grows from 8.0 to 14.0 based on charge (0-100%)
  • Color: Orange (1.0, 0.4, 0.0) → Yellow (1.0, 1.0, 0.0)
  • Alpha: Increases from 0.6 to 1.0 as it charges
  • Duration: Matches 1-second force cap from game mechanics
  • Particles: Pulsing yellow circles at bow tips when >90% charged

Charging Mechanics

  • 0-5% charge: No visual (prevents flicker)
  • 5-90% charge: Growing orange-to-yellow arc
  • 90-100% charge: Full arc + pulsing energy particles
  • Release: Effect disappears instantly on launch

Bow Design

  • Shape: 180-degree arc behind Earth (semicircle)
  • Layers: 3 concentric arcs for thickness effect
  • Segments: 20 line segments per arc for smooth curve
  • Transparency: Outer arcs more transparent for depth
  • Particles: 2 pulsing circles at arc endpoints when charged

Benefits

  • Provides clear visual feedback for force charging
  • Helps mobile users understand hold-to-charge mechanic
  • Shows exactly how much force will be applied
  • Makes launch power predictable and controllable
  • Enhances mobile UX with intuitive visual language
  • Adds satisfying visual feedback for charging
  • Matches bow-and-arrow metaphor for launching

Technical Implementation

  • Queries LaunchArmed to check if earth is selected
  • Uses LaunchState.launched_at_time to calculate hold duration
  • Calculates charge percentage (0.0 to 1.0) capped at 1 second
  • Draws arc using multiple line segments in semicircle
  • Color interpolation based on charge percentage
  • Particle pulse uses sine wave animation
  • Uses gizmos for efficient rendering

Force Visualization

  • Visual charge directly corresponds to actual launch force
  • Game caps force at 1 second hold time
  • Bow visualization matches this 1-second cap
  • Players can see exactly how much force they're applying
  • Helps with precision launches and orbital mechanics

Performance

  • Lightweight: Only draws when charging
  • Efficient: Uses gizmos (no sprites/meshes)
  • Minimal: ~60 line segments + 2 circles when fully charged
  • Real-time: Updates every frame for smooth animation
  • Clean: No entity spawning (pure rendering)

Testing

  • Tap and hold Earth on mobile device
  • Verify orange arc appears behind Earth
  • Hold longer and verify arc grows and turns yellow
  • Hold for 1 second and verify pulsing particles appear
  • Release and verify arc disappears
  • Check that arc size correlates with launch force
  • Test that color transition is smooth

Related Issue

Fixes: Android/Mobile Feedback - When touching longer this force needs symbolising, a charging bend of a bow behind earth (mobile)

- Created new charging_bow module
- Implemented draw_charging_bow system
- Shows expanding arc behind Earth as touch is held
- Arc grows from 8.0 to 14.0 radius over 1 second
- Color transitions from orange to yellow as it charges
- Pulsing energy particles at bow tips when fully charged
- Visual feedback for launch force magnitude
- Helps mobile users understand charge mechanic
- Integrated into effects plugin system
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