Preview

This Unity 2D game prototype is a simple snowboarding game where the player controls a snowboarder navigating a course. The main features include player movement with rotation and speed boost, crash detection with visual and audio feedback, a finish line with celebratory effects, and a dust trail effect when the snowboarder is in contact with the ground. The game resets upon crashing or reaching the finish line, providing a looped gameplay experience suitable for prototyping core mechanics.

The core game mechanics involve controlling the snowboarder using the arrow keys: left/right arrows rotate the player, and the up arrow boosts speed. Crashing into the ground triggers a crash effect and disables controls, while reaching the finish line plays a finish effect and restarts the level after a delay. The design is minimal, focusing on responsive controls, immediate feedback, and clear win/lose conditions, making it ideal for learning or demonstrating basic 2D physics and interaction in Unity.

Technically, the project uses C# scripts to manage player input, physics interactions (via Rigidbody2D and SurfaceEffector2D), particle effects, and audio playback. Key Unity concepts demonstrated include component referencing, collision detection (OnTriggerEnter2D, OnCollisionEnter2D/Exit2D), scene management, and serialized fields for easy tuning in the editor. By building this prototype, a developer gains practical experience in Unity scripting, 2D physics, event-driven programming, and rapid prototyping essential skills for beginner to intermediate Unity developers.

[https://drive.google.com/file/d/1pP8ORbDiSO9OHioRCzMLSJH8YCaXmGVI/view?usp=drive_link](https://drive.google.com/file/d/1pP8ORbDiSO9OHioRCzMLSJH8YCaXmGVI/view?usp=drive_link)

Codebase

Player Movement & Rotation

Description:

Allows the player to control the snowboarder’s speed and rotation using keyboard input, creating responsive and skill-based movement.

void Update()
{
    RotatePlayer();
    RespondToBoost();
}

void RotatePlayer()
{
    if (Input.GetKey(KeyCode.LeftArrow))
    {
        rigidbody2D.AddTorque(torqueAmount);
    }
    else if (Input.GetKey(KeyCode.RightArrow))
    {
        rigidbody2D.AddTorque(-torqueAmount);
    }
}

void RespondToBoost()
{
    if (Input.GetKey(KeyCode.UpArrow))
    {
        surfaceEffector2D.speed = boostSpeed;
    }
    else
    {
        surfaceEffector2D.speed = baseSpeed;
    }
}
flowchart TD
    A[Player presses arrow keys] --> B{Left/Right/Up?}
    B -- Left --> C[Add positive torque]
    B -- Right --> D[Add negative torque]
    B -- Up --> E[Increase speed]
    B -- None --> F[Normal speed]

Crash Detection

Description:

Detects when the snowboarder crashes, disables controls, and plays crash effects.

void OnTriggerEnter2D(Collider2D other)
{
    if (other.tag == "Ground")
    {
        crashEffect.Play();
        crashSound.Play();
        playerController.DisableControls();
        Invoke("ReloadScene", reloadDelay);
    }
}
flowchart TD
    A[Player collides with Ground] --> B[Play crash effect & sound]
    B --> C[Disable player controls]
    C --> D[Reload scene after delay]

Finish Line Detection