Blog Tutorial

Making a 2D breakout game in Lenga

In this tutorial series, we will build **Block Out**, a small 2D Breakout-style game in Lenga.

This is a compact project, but it exercises a real slice of the engine: scenes, GameObjects, components, 2D physics, PHP scripts, events, UI canvases, input actions, fonts, materials, trails, state transitions, and export settings.

By the end of the series, you will have:

  • a paddle controlled by input and moved with Rigidbody2D
  • a ball that follows the paddle until launch
  • a 4-by-8 brick layout with row-based scoring
  • walls, a floor trigger, and out-of-bounds handling
  • score, lives, pause, win, and game-over UI
  • a small gameplay state flow
  • optional polish such as trails, tweens, particles, and audio
  • a native export that can run outside the editor

What We Are Building

Breakout has a simple loop:

  • launch the ball from the paddle
  • keep the ball alive
  • break every brick
  • lose a life when the ball falls below the paddle
  • show a win or game-over menu when the round ends

That simplicity is useful. We can focus on how a complete Lenga game is assembled without burying the project under too many mechanics.

Series Outline

  1. Introduction.
  2. Load the game assets.
  3. Create the ball.
  4. Add walls and colliders.
  5. Move the paddle with physics.
  6. Launch and reset the ball.
  7. Handle out-of-bounds and lives.
  8. Build the brick field.
  9. Break bricks and score points.
  10. Build the HUD and menus.
  11. Add polish and export the game.

Each part has a checkpoint. If something stops working, return to the most recent checkpoint and fix the smallest broken piece before moving on.

Project Shape

The finished project uses this structure:

Assets/
  Branding/
  Fonts/
  Materials/
  Physics/
  Prefabs/
  Scenes/
  Scripts/
  Sprites/

Most of the game is authored in one editor scene named Level1. The PHP scripts live in Assets/Scripts, and Composer maps the project namespace to Assets/.

{
  "autoload": {
    "psr-4": {
      "BreakOut\\Game\\": "Assets/"
    }
  }
}

That means a script at Assets/Scripts/Paddle.php uses a namespace such as:

namespace BreakOut\Game\Scripts;

Input Actions

The project uses named input actions instead of checking raw key codes directly:

  • Horizontal
  • Vertical
  • Jump
  • Launch
  • Pause
  • Confirm

This series uses Horizontal, Launch, Pause, and Confirm; the extra actions are available for later experiments.

This keeps gameplay code readable and lets the input bindings change later without rewriting scripts.

How the Series Is Paced

Each part adds one visible piece of the game and ends with a checkpoint. The series starts with a single ball, then introduces walls, paddle movement, out-of-bounds detection, bricks, scoring, UI, and export one step at a time.

By the time the final part is complete, the project will have a playable Breakout-style loop with score, lives, pause, win, and game-over states.

When you are ready, continue with Part 1 — Introduction.