GAME 1303 — Helper Script Library
This is not a scripting course. You are given a library of documented, working scripts. Your job is to read them, attach them, wire them up, and change their values — not to write systems from scratch.
Every script exposes its tuning values in the Inspector (Unity) or as instance-editable variables (Unreal). Every design decision you make in an exercise is a decision about those values, or about how the pieces are connected.
- Unity 6.x scripts use the New Input System and UI Toolkit. No legacy
Input.GetAxis, no uGUI Canvas. - Unreal 5.8 equivalents ship as Blueprint templates using Enhanced Input and UMG.
Download: [Canvas → Files → HelperScripts] · Unity .unitypackage · Unreal plugin/content pack
Movement
PlayerMove2D
Top-down or side-scrolling 2D movement driven by an Input Actions asset.
| Value | What it does |
|---|---|
moveSpeed | Units per second at full stick or key press |
acceleration / deceleration | How fast you reach and lose top speed — the single biggest lever on how a game feels |
jumpHeight | Peak height in units (side-scroll mode) |
coyoteTime | Grace period to still jump after leaving a ledge |
jumpBuffer | Grace period for a jump pressed just before landing |
dashSpeed / dashDuration / dashCooldown | Optional dash, disabled by default |
Requires: Rigidbody2D, Collider2D, and a PlayerInput component pointing at PlayerControls.inputactions.
PlayerMove3D
Character-controller movement for 3D and VR tracks. Same tuning vocabulary plus turnSpeed, gravityScale, and a locomotionMode toggle (smooth / teleport) for VR.
Verb components
One per core mechanic. Used in Ex 2 — The Verb; you attach exactly one. Unreal equivalents are the BPC_ components named in brackets.
Grabber (BPC_Grabber)
Pick up, carry, and throw physics objects.
| Value | What it does |
|---|---|
grabRange | How far in front the pickup check reaches |
holdOffset | Where the held object sits relative to the player |
throwForce | Impulse applied on release |
disablePhysicsWhileHeld | On by default — prevents the held object fighting the player's collider |
Objects need a Rigidbody, a Collider, and the Grabbable tag.
Shooter (BPC_Shooter) + Projectile (BP_Projectile)
Spawns a projectile prefab on input.
| Value | What it does |
|---|---|
projectilePrefab | What gets spawned |
projectileSpeed | Launch speed |
fireRate | Shots per second, rate-limited |
lifetime | Set this. At 0, projectiles never despawn and the scene fills up. |
Swapper (BPC_Swapper)
Trades places with the nearest tagged object. swapRange, swapTargetTag, swapCooldown.
Grappler (BPC_Grappler)
Attaches to a tagged anchor and pulls the player toward it. maxRange, pullSpeed, anchorTag. Needs a LineRenderer (Unity) or Cable Component (Unreal) on the same object for the visible line.
Interactor (BPC_Interactor) + Interactable (BPI_Interactable)
Context-sensitive use of whatever the player is facing. Interactor goes on the player; Interactable goes on each usable object and exposes an OnInteract event you hook in the Inspector — no code. The backbone of the Narrative track.
Feedback and audio
SoundPlayer
A single point of contact for audio. Call SoundPlayer.Play("jump") from anywhere, or drop a clip reference on an event in the Inspector.
| Value | What it does |
|---|---|
pitchVariance | Randomizes pitch per shot so repeated sounds don't fatigue the ear |
maxConcurrent | Caps simultaneous instances of one sound |
musicTrack / musicVolume | Looping background track with fade in/out |
ScreenShake
Attaches to a virtual camera. Shake(amplitude, duration). Keep it small — most beginners shake ten times too hard.
HitFlash
Briefly tints a sprite or material on damage. flashColor, flashDuration.
Game state and rules
GameStateManager
Holds the game in one of: Playing, Paused, Won, Lost. Everything else listens to it.
| Member | What it does |
|---|---|
OnStateChanged | Event other systems subscribe to |
Win() / Lose() | Called by triggers, health, or timers |
Restart() | Reloads the active scene cleanly |
TogglePause() | Freezes time and raises the pause screen |
restartKey | Key that triggers a restart — set to R while developing |
restartDelay | Seconds between failing and playing again. The consequence dial — under 0.3 feels blameless, over 1.5 feels dreadful. |
showDebugState | Draws the current state on screen. Your temporary UI until Ex 7. |
lives | 0 = disabled. Above 0, Lose() decrements and only ends the game at zero. |
respawnAtCheckpoint | Send the player to the last Checkpoint instead of restarting the scene |
TriggerZone
A generic enter/exit event emitter. Drop it on any collider set to Is Trigger and hook its events in the Inspector — no code needed. Use it for goals, hazards, doors, checkpoints, cutscene triggers, and music changes.
| Value | What it does |
|---|---|
requiredTag | Only objects with this tag fire the event — usually Player |
triggerOnce | Fire once and stop. On for goals, off for hazards. |
OnEnter () / OnExit () | Inspector event slots. Both an object and a function must be selected, or nothing happens. |
Checkpoint
Stores the last-touched position and respawns the player there on death.
Progression
Health
| Value | What it does |
|---|---|
maxHealth | Starting and cap value |
invulnerabilityTime | Seconds of immunity after a hit — prevents instant death from overlaps |
OnDamaged / OnHealed / OnDeath | Events for UI, audio, and VFX to listen to |
Score
Score, combo multiplier, and session high score, with an OnScoreChanged event that UIManager binds to directly.
Spawner / ObjectPool
Timed, wave, or trigger-driven spawning that recycles instances instead of instantiating and destroying. spawnInterval, waveSize, rampRate — the rampRate value is your difficulty curve.
Interface
UIManager (UI Toolkit)
Manages screens as UXML documents and swaps between them based on GameStateManager state.
| Member | What it does |
|---|---|
ShowScreen(name) | Raises Title, HUD, Pause, Win, or Lose |
BindHUD(health, score) | Live-binds label and bar elements to the source events |
screenAsset list | Assign your .uxml files here |
Ships with a starter GameUI.uxml and GameUI.uss containing a title screen, HUD with health bar and score label, pause menu, and win/lose screens. Restyle them freely — that restyling is the graded design decision in Ex 7.
DialogueTrigger
Displays a sequence of text beats when the player enters a zone. Set beats (a list of strings), advanceMode (auto-timed or input), and displayDuration. Used in Ex 6 and by every Narrative track project.
Testing
PlaytestLogger
Writes timestamped events to a local log file so you have data, not just impressions, after a playtest.
Logs by default: session start/end, deaths, level completions, time per level, and any custom event you call PlaytestLogger.Log("event name") on. Output lands in the persistent data path; the exercise walks you through finding it.
Rules for using the library
- Read the script before you attach it. Every one has a header comment explaining what it does and which values matter.
- Modify freely. Changing a helper script is encouraged and never penalized.
- Credit it. List which helpers you used in your Game Design Doc and build notes.
- If a helper fights your design, cut it. These are scaffolding for the common cases, not a required architecture.