Build OrbitRun with Smart Shape | Part 4: Sound and finishing touches
Logo
DocumentationTutorialsBuild OrbitRun with Smart Shape | Part 4: Sound and finishing touches

A short sound can make a good flight feel better. Add music and a trail, then give launches and world changes their own effects. You’ll also add a retry screen in case the course fails to load.

Continue from Part 3, or open OrbitRun-12-personal-best.tap from the checkpoint pack. The original asset pack includes the audio and particle files used here. The assets-only starter and every later checkpoint already have them imported.

In the diagrams, REUSE means use the behavior you already added. For a reminder of the gestures, see connecting behaviors in Part 1. You can tap an image to open it at full size.

13. Add music that remembers the player's choice

Start with the Music Button you placed on the title screen.

Build the button first

The bottom (true) output turns music off. The right (false) output turns it on.

Animated connection guide: Music button: true or false

  1. Add Started Touching named Music Touch.
  2. Add Get Attribute named Music State. Connect a free bottom white circle on Music Touch to Music State.
  3. Add If named Music Check. Connect a free bottom white circle on Music State to Music Check.
  4. Add Set Attribute named Music Off. Connect Music Check’s bottom (true) circle to Music Off.
  5. Add Set Attribute named Music On. Connect Music Check’s right (false) circle to Music On.

Properties: Music Touch targets Music Button, Touch Anywhere Off, Absorbs Touch On. Music State reads Skimmer’s music attribute. Music Check compares that Attribute Value Equals 1. Music Off sets music to 0; Music On sets it to 1.

On the off path, update the label and save the choice before muting.

Animated connection guide: Turn music off

  1. Reuse Music Off.
  2. Add Change Label named Music Off Label. Connect a free bottom white circle on Music Off to Music Off Label.
  3. Add Modify Save File named Save Mute. Connect a free bottom white circle on Music Off Label to Save Mute.
  4. Add Set Music Settings named Mute. Connect a free bottom white circle on Save Mute to Mute.

Off settings: Music Off Label targets Music Label, text MUSIC OFF. Save Mute uses Modify Save File: Set Key, Dynamic, orbit-music-volume-v1, value 0. Mute uses Set Music Settings: Change Volume On, volume 0, with a short fade.

The on path uses the same order and restores the listening volume.

Animated connection guide: Turn music on

  1. Reuse Music On.
  2. Add Change Label named Music On Label. Connect a free bottom white circle on Music On to Music On Label.
  3. Add Modify Save File named Save Unmute. Connect a free bottom white circle on Music On Label to Save Unmute.
  4. Add Set Music Settings named Unmute. Connect a free bottom white circle on Save Unmute to Unmute.

On settings: Music On Label targets Music Label, text MUSIC ON. Save Unmute uses the same Dynamic key with value 35. Unmute changes volume to 35, with a short fade.

Load the saved choice

When the scene opens, load the saved volume and check whether it was muted.

Animated connection guide: Restore the saved music choice

  1. Add Load from Save File named Load Music.
  2. Add Play Music named Music. Connect a free bottom white circle on Load Music to Music.
  3. Add If named Restore Muted. Connect a free bottom white circle on Load Music to Restore Muted.
  4. Reuse Music Off. Connect Restore Muted’s bottom (true) circle to Music Off.

Properties: Load Music uses key orbit-music-volume-v1, default 35, and remains at the top level. The default and saved “on” volume should match; choose a comfortable listening level. Music uses orbit-loop, Loop On, Preload On, Start Time 0, Persistent Off. Restore Muted compares Load Music’s Loaded Value Equals 0. Its true connection reuses Music Off, restoring the attribute, label and sound together.

The Play Music reference explains these controls. Tap the track field, open Sounds, and choose orbit-loop:

Selecting the music track in the real editor

Use the saved volume

Select the receiving behavior, drag the source output into Volume, choose loadedValue, and check the resulting reference

After you drop it, Volume contains Load Music · loadedValue. Keep Loop and Preload on.

Music settings after adding the volume reference

Toggle the button on the title screen and during a run. Its label should update immediately. Replay and confirm the choice is retained. Tapping the music button should not act as a dive touch.

The connection order saves the choice before the fade starts. That way, you don’t have to wait for a fade to finish before the setting is stored. Short sound effects will still play when music is off.

14. Add motion and reward feedback

Leave a light trail

Aim for a small streak that makes the ship’s movement easy to follow:

The finished trail follows the ship without obscuring the terrain

The launch-effects guide below adds Trail (Start Trail). Target Skimmer and choose orbit-trail. Give it a light tint, a thin stroke, and a short fade. Enable Fade to Transparent and draw it behind the ship. Adjust its appearance while playing.

Reward fast flight without repeating constantly

Use the If, Timer, and Play Sound references while setting up this branch.

Properties: Flow Check compares Velocity’s Speed output > 30. Flow Cooldown disables Flow Check using Set Behavior State. Its four children have these settings:

  • Flow Sound (Play Sound): orbit-chime, Loop Off; keep it quieter than the main effects
  • Show Flow (Set Visibility): Show Flow Label
  • Flow Hide Timer (Timer): 1.4 s, once, Start Immediately Off. Hide Flow (Set Visibility) hides Flow Label
  • Flow Reset Timer (Timer): 4 s, once, Start Immediately Off. Flow Rearm (Set Behavior State) enables Flow Check, Executes Immediately Off

A fast flight shows the reward and starts the cooldown.

Animated connection guide: Reward a fast flight once

  1. Reuse Velocity.
  2. Add If named Flow Check. Connect a free bottom white circle on Velocity to Flow Check.
  3. Add Set Behavior State named Flow Cooldown. Connect Flow Check’s bottom (true) circle to Flow Cooldown.
  4. Add Set Visibility named Show Flow. Connect a free bottom white circle on Flow Cooldown to Show Flow.
  5. Add Play Sound named Flow Sound. Connect a free bottom white circle on Flow Cooldown to Flow Sound.

Hide the message after a short pause. Wait longer before allowing another chime.

Animated connection guide: Hide the message; rearm later

  1. Reuse Flow Cooldown.
  2. Add Timer named Flow Hide Timer. Connect a free bottom white circle on Flow Cooldown to Flow Hide Timer.
  3. Add Timer named Flow Reset Timer. Connect a free bottom white circle on Flow Cooldown to Flow Reset Timer.
  4. Add Set Visibility named Hide Flow. Connect a free bottom white circle on Flow Hide Timer to Hide Flow.
  5. Add Set Behavior State named Flow Rearm. Connect a free bottom white circle on Flow Reset Timer to Flow Rearm.

Flight Tick checks speed twenty times a second. Without the cooldown, it could play the chime on every check. Disabling Flow Check gives the sound four seconds of quiet before it can play again.

Add three small moments of celebration

Use the Start Particles reference for the particle controls. The guides below connect a Play Sound and Start Particles pair to each event. Keep sounds and particles Loop Off. Target Skimmer for particles and let the supplied presets provide the burst. Adjust volume by ear so feedback is clear over the music.

  • Launch: orbit-launch sound and orbit-launch-sparks particles
  • Successful world change: orbit-biome sound and orbit-biome-glow particles
  • Finish: orbit-reward sound and orbit-reward-stars particles

Use aliases Launch Sound / Launch Burst, Biome Sound / Biome Burst, and Reward Sound / Reward Burst. Both world-success branches can share the same Biome Sound and Biome Burst behaviors. The supplied particle presets are short, bounded bursts; avoid changing them to continuous emitters for these events.

Start the trail and launch effects when Generate reports Ready.

Animated connection guide: Launch: trail, sound and burst

  1. Reuse Generate.
  2. Add Start Trail named Trail. Connect a free bottom white circle on Generate to Trail.
  3. Add Play Sound named Launch Sound. Connect a free bottom white circle on Generate to Launch Sound.
  4. Add Start Particles named Launch Burst. Connect a free bottom white circle on Generate to Launch Burst.

Both successful world changes can use the same sound and particle behaviors.

Animated connection guide: World change: shared effects

  1. Reuse Aurora Fill Valid.
  2. Reuse Ember Fill Valid.
  3. Add Play Sound named Biome Sound. Connect Aurora Fill Valid’s bottom (true) circle to Biome Sound. Connect Ember Fill Valid’s bottom (true) circle to Biome Sound.
  4. Add Start Particles named Biome Burst. Connect Aurora Fill Valid’s bottom (true) circle to Biome Burst. Connect Ember Fill Valid’s bottom (true) circle to Biome Burst.

Give the end of a run its own sound and burst.

Animated connection guide: Finish: sound and burst

  1. Reuse Finished.
  2. Add Play Sound named Reward Sound. Connect a free bottom white circle on Finished to Reward Sound.
  3. Add Start Particles named Reward Burst. Connect a free bottom white circle on Finished to Reward Burst.

Launch, earn a fast-flight reward, and let the run finish. Listen for a distinct launch, world-change, and finish sound. ORBIT FLOW should disappear after about 1.4 seconds and should not chatter continuously while the ship stays fast.

15. Give a stalled launch a way to recover

If the course is still preparing after 15 seconds, offer a retry. Cancel that attempt before returning to the title screen.

Properties for the recovery guides: Loading Watchdog is a 15-second timer, once, Start Immediately Off. Loading State reads Skimmer’s runState. Loading Check compares that Attribute Value Equals menu. Cancel Preparation disables Generate. Failed State sets Skimmer’s runState to finished.

Reuse Hide Menu and Show Results. Configure the three new Change Label behaviors:

  • Loading Title: Target: Results Title; Text: LET'S TRY THAT AGAIN
  • Loading Score: Target: Results Score; Text: RETRY
  • Loading Tip: Target: Results Tip; Text: The moon took too long to prepare. then Tap FLY AGAIN for a fresh course.

Start the watchdog when LAUNCH is tapped. After 15 seconds, check whether the game is still in the menu state.

Animated connection guide: Check whether launch is stuck

  1. Reuse Disarm Start.
  2. Add Timer named Loading Watchdog. Connect a free bottom white circle on Disarm Start to Loading Watchdog.
  3. Add Get Attribute named Loading State. Connect a free bottom white circle on Loading Watchdog to Loading State.
  4. Add If named Loading Check. Connect a free bottom white circle on Loading State to Loading Check.
  5. Add Set Behavior State named Cancel Preparation. Connect Loading Check’s bottom (true) circle to Cancel Preparation.
  6. Add Set Attribute named Failed State. Connect a free bottom white circle on Cancel Preparation to Failed State.

Reuse the menu and results behaviors to show a retry screen.

Animated connection guide: Recovery: show the retry panel

  1. Reuse Failed State.
  2. Reuse Hide Menu. Connect a free bottom white circle on Failed State to Hide Menu.
  3. Reuse Show Results. Connect a free bottom white circle on Failed State to Show Results.

Change the results text so the player knows to try again.

Animated connection guide: Recovery: explain the retry

  1. Reuse Failed State.
  2. Add Change Label named Loading Title. Connect a free bottom white circle on Failed State to Loading Title.
  3. Add Change Label named Loading Score. Connect a free bottom white circle on Failed State to Loading Score.
  4. Add Change Label named Loading Tip. Connect a free bottom white circle on Failed State to Loading Tip.

Make a test copy first. In that copy, disconnect Disarm Start → Generate, leaving Loading and Loading Watchdog connected. Play and tap LAUNCH. After about 15 seconds, the retry panel should appear, with no terrain launch or running clock. FLY AGAIN should return to the title screen. Reconnect Generate before keeping or sharing that test copy.

The retry panel reached by disconnecting Generate in a test copy

When the course loads normally, Ready changes runState to running. The 15-second check then does nothing. If preparation fails, you set runState to finished, which lets your existing replay button handle the retry.

Playtest the foundation

Run these checks on the normal project, with Generate connected:

  • The title screen stays still until LAUNCH, and repeated launch taps do not start extra runs.
  • Holding dives, releasing glides, and music-button taps do not trigger the touch surface.
  • Distance rises from the starting position; the countdown starts after terrain is ready.
  • Luna changes to Aurora at 30 seconds elapsed, then Ember at 60 seconds elapsed.
  • At 90 seconds, movement stops and FLY AGAIN works.
  • A better distance survives replay; a worse distance does not replace it.
  • Music preference survives replay, and short effects still work with music off.
  • The separate recovery test reaches RETRY and returns to the menu.

If something looks wrong

  • Ship falls before the course exists: World gravity is zero; Menu Gravity targets Skimmer; Launch and Release start from Ready
  • LAUNCH never starts a course: Start Touch targets Start; Disarm Start connects to Generate; the generated terrain follows Skimmer
  • Touch does nothing: Input Plane is on Scene UI, covers the screen, has opacity 0%, and remains visible
  • Rotation jitters or flips: X > 0.1 guard, Y ÷ X order, Arctangent, then multiply by −1
  • Score starts at a large number: Read world X and subtract the ship's starting X, 8 m
  • World label changes but terrain does not: Target Generate.terrainObjectID, choose Top/Middle slots, and inspect each smartShapeError output
  • Ship moves after the results appear: Disable Flight Tick and set both velocities to zero with both Maintain switches Off
  • Music label disagrees with sound: Check the music attribute and the full state → label → save → fade chains
  • A save appears to belong to an earlier sample: Use a unique prefix for the two save keys in your own game

Next: find the flow

You can now play a complete run and return for another. Part 5 focuses on how the flight feels, including a camera that pulls back as the ship soars. After that, you’ll place batteries in the valleys.

All checkpoints · Original assets