<aside> <img src="/icons/reorder_gray.svg" alt="/icons/reorder_gray.svg" width="40px" />

Navigation

</aside>

🏠 Home Page

Getting Started

Architecture

Level System

Characters & Vehicles

Run Mechanics

World Objects

Boosters & Modifiers

Progression & Economy

UI

Save & Debugging

Modules

Publishing

Reference

💰 Monetization (Ads & IAP)

<aside> 💡 LevelSetup defines the objects that GameController spawns around the character for a level: the launcher, the aim input type, the launch ramp, the finish flag and the record wall.

</aside>

Subsystems

level-setup.png

LevelSetup fields

Menu: Create → Watermelon → Progression → Level Setup.

Field Description
Launcher Prefab The launcher prefab. Spawned once per GameController load.
Aim Input Type Drag or Timing. Selects the aim input that is enabled in the Game scene.
Play Launch Animation Timing input with a slingshot only. After the tap, the slingshot pulls back to the chosen power and fires. When disabled, the character launches on the tap.
Launch Animation Duration Duration of the pull animation.
Launch Ramp Prefab Optional. Placed at the Start Point. The launcher and the character stand on its Launch Point.
Character Behind Launcher Distance between the character and the launch point, so the rope already wraps the character back at rest.
Flag Prefab Flag shown at the end of the run.
Record Wall Prefab Wall shown at the record distance.

A level that has no Setup Override uses the Default Level Setup from Game Data. See Level Asset & Levels Database.

Included setups

Asset Launcher Aim input Ramp
Default Level Setup Slingshot Launcher Drag None
Car Level Setup Slingshot Launcher Car Drag None
Plane Level Setup Slingshot Launcher Timing Launch Ramp

Launcher, flag and record wall prefabs are stored in Assets/Project Files/Game/Prefabs/Level Setup.

Aim inputs

GameController has a reference to every AimInput of the Game scene. At Awake, it enables the input whose Type matches LevelSetup.AimInputType and disables the others. The list is filled when the Game scene is saved.

An aim input reports three values, from 0 to 1 (the third one from -1 to 1):

Value Drag Timing
a Pull tension Power
b Launch angle, same as the tension Power
c Side direction 0
Input Behavior
AimDragInput The player drags down from the first touch. The pull sets the tension and the angle, the sideways drag sets the side direction in the opposite direction, like a real slingshot. A release with a pull below Min Launch Tension is cancelled.
TimingAimInput A needle swings over an arc. A tap locks the position as power. The power is the highest at the center of the arc.

Events of AimInput:

Event When
OnAimChanged(a, b, c) The player changes the aim. Drives the slingshot visuals.
OnAimReleased(a, b, c) The player confirms the launch.
OnDragStateChanged(bool) Drag start and end. Used to hide the UI while pulling.

Launchers

All launchers share these fields from the Launcher base class:

Field Description
Muzzle Launch point.
Min Force, Max Force Launch force range.
Visual Root, Default Visual Optional objects used to swap the visual with the launcher power upgrade.

The launch velocity is multiplied by the Launcher Power upgrade multiplier of the current level.

Launcher Behavior
SlingshotLauncher The tension sets the force, the angle value is mapped to Min Angle…Max Angle, the side value turns the launch up to Max Yaw. The rope is a physics chain that wraps the character at the Rope Point.
TimingLauncher The power sets the force. The angle is fixed by the Angle field.

The slingshot rope wraps the Rope Point of the character visual. See Characters & Vehicles.

Launch ramp

The root of the ramp prefab has LaunchRampBehavior. Its pivot is placed at the Start Point. The Launch Point child defines the position and the tilt of the launcher and the character on the ramp deck.

How to add a new Level Setup

  1. Create the asset. Open Create → Watermelon → Progression → Level Setup in the Project window.
  2. Assign the prefabs. Link the launcher, the flag and the record wall. Link a ramp prefab if the level needs one.
  3. Set the aim input. Choose Drag or Timing.
  4. Link the setup. Select the Level asset and assign the new asset to Setup Override.

How to add a new Launcher

  1. Create the script. Inherit from Launcher and implement GetLaunchVelocity().
  2. Create the prefab. Add the script to a prefab, assign the Muzzle and the force range.
  3. Link the prefab. Assign it to Launcher Prefab of a LevelSetup.

GameController calls the extra methods only for SlingshotLauncher (load, aim, release) and TimingLauncher (power). Any other launcher is used through GetLaunchVelocity(). Pass the values of the aim input to the launcher in Launch of GameController when the new launcher needs them.

How to add a new Aim Input

  1. Add an enum value. Add a value to AimInputType.
  2. Create the script. Inherit from AimInput, return the new type and raise the events.
  3. Add it to the Game scene. Add the component to an object of the aim UI in the Game scene.
  4. Save the scene. The input list of GameController is filled on scene save.
  5. Select the type. Set the new Aim Input Type in a LevelSetup.