# 🎯 Dragon Boom

A fast-paced 2D balloon grid logic puzzle and arcade shooter built in **C++** and **SFML**.

[![C++17](https://img.shields.io/badge/C%2B%2B-17-00599C?logo=c%2B%2B&logoColor=white)](https://isocpp.org/)
[![SFML](https://img.shields.io/badge/SFML-2.6.x-8CC445?logo=sfml&logoColor=white)](https://www.sfml-dev.org/)
[![Platform](https://img.shields.io/badge/Platform-Windows-0078D6?logo=windows&logoColor=white)](https://github.com/)

---

## 📖 Overview

**Dragon Boom** combines spatial grid reasoning with timed arcade shooting. Each edge of the grid is loaded with colored darts. Move your aim reticle around the outer boundary, align with your target row or column, and fire. 

Pop all balloons matching your dart's color to clear the board—hit a mismatched color or let the timer run out, and you lose.

```
                    ▲ [Aim Reticle] (Press Enter)
                    │
           ┌────────▼────────┐
      [🔴] │  🔴   🔴   🔵   │ [🔴]
      [🔵] │  🟢   🔴   🟢   │ [🟢]  ◄── Boundary Darts
      [🟢] │  🔵   🟢   🔵   │ [🔵]
           └─────────────────┘
```

---

## ✨ Features

* **3 Difficulty Tiers:**
  * **Easy:** 4×4 Grid · 60s Timer
  * **Medium:** 5×5 Grid · 30s Timer
  * **Hard:** 6×6 Grid · 15s Timer
* **Procedural Puzzle Generation:** Dynamic board layouts, randomized permutations, and color remapping for high replayability.
* **Persistent Lives & Cooldown:** 3-life allowance stored locally on disk; triggers a 1-hour lockout penalty when depleted.
* **Real-Time Projectile Collision:** Bounding-box hit detection between traveling dart entities and grid cells.
* **Audio & Animated UI:** State-driven screens (Menus, Ready, Level Select, Game Over), animated sprites, HUD timer, and SFX.
* **Object-Oriented Design:** Polymorphic entity architecture driven by a `DrawableEntity` base class.

---

## 🕹️ Game Flow & Architecture

### State Machine

```mermaid
stateDiagram-v2
    [*] --> MainMenu
    MainMenu --> ReadyScreen: Start Clicked
    ReadyScreen --> LevelSelect: Has Lives
    ReadyScreen --> Lockout: 0 Lives (1hr cooldown)
    LevelSelect --> Gameplay: Select Difficulty
    Gameplay --> WinScreen: Grid Cleared
    Gameplay --> LoseScreen: Wrong Color / Time Out / Out of Darts
    LoseScreen --> ReadyScreen: Deduct 1 Life
    WinScreen --> ReadyScreen: Retain Lives
```

### Class Hierarchy

```mermaid
classDiagram
    class DrawableEntity {
        <<Abstract>>
        +virtual void draw(RenderWindow& window)*
        +virtual void update(float dt)*
    }
    class Aim {
        -int currentEdge
        -Vector2f position
        +void moveClockwise()
        +void moveCounterClockwise()
        +void draw(RenderWindow& window)
    }
    class Projectile {
        -Color dartColor
        -Vector2f velocity
        +void checkCollision()
        +void draw(RenderWindow& window)
    }

    DrawableEntity <|-- Aim
    DrawableEntity <|-- Projectile
```

---

## 🎮 Controls

| Input | Target Action |
| :--- | :--- |
| **Mouse Left-Click** | Menu navigation, level selection, dialog confirmations |
| **Arrow Keys (↑ / ↓ / ← / →)** | Move the aim reticle around the grid perimeter |
| **Enter** | Fire dart into the aligned row or column |
| **Exit Icon (Top-Left)** | Pause game and display exit confirmation prompt |

---

## 📜 Rules & Penalties

* **Color Matching:** A projectile only clears balloons matching its active color.
* **Sudden Death:** Colliding with a mismatched balloon ends the round immediately.
* **Loss Triggers:**
  * Timer reaches `00:00`.
  * Dart impacts the wrong color balloon.
  * All border darts are consumed before the board is cleared.
* **Lives & Persistence:**
  * Players start with **3 lives**.
  * State and cooldown timestamps are serialized to `lives_state.txt`.
  * Losing all 3 lives locks gameplay for **1 hour**.

---

## 🛠️ Tech Stack

* **Language:** C++17
* **Framework:** SFML 2.6.x (Graphics, Audio, Window, System)
* **Compiler:** MinGW-w64 (GCC)
* **Target Environment:** Windows

---

## 🚀 Build & Installation

### Prerequisites

1. **MinGW-w64** GCC compiler installed with C++17 support.
2. **SFML 2.6.x (GCC MinGW)** downloaded from [sfml-dev.org](https://www.sfml-dev.org/download.php).
3. Asset files placed in the project root directory.

### Compilation

Replace `C:/path/to/SFML` with your actual SFML installation directory:

```bash
g++ -std=c++17 image.cpp ^
    -I "C:/path/to/SFML/include" ^
    -L "C:/path/to/SFML/lib" ^
    -lsfml-graphics -lsfml-audio -lsfml-window -lsfml-system ^
    -o balloon_game.exe
```

### Running the Game

Ensure the required SFML DLLs (e.g., `sfml-graphics-2.dll`, `openal32.dll`) are placed in the same folder as `balloon_game.exe`, then run:

```bash
./balloon_game.exe
```
