> ## Documentation Index
> Fetch the complete documentation index at: https://docs.rollingquest.kramgames.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Level Editor — Building Levels Visually

> Complete guide to the RollingQuest in-game level editor. Learn how to place blocks, items, enemies, balls, decorations, configure sections, and test your level.

The RollingQuest level editor is a built-in tool that lets you design levels visually without any external software. You place blocks, items, enemies, and decorations using keyboard shortcuts and mouse clicks, configure properties through menus, and test your level instantly.

## Opening the Editor

From the Main Menu, click **Level Editor**. This loads the editor scene where you can create a new level or continue working on the current one.

***

## Basic Controls

### Navigation

| Key             | Action                                                          |
| --------------- | --------------------------------------------------------------- |
| **W/A/S/D**     | Move the block selector cursor on the horizontal plane          |
| **E/Q**         | Move the selector up/down (Y axis)                              |
| **Left Click**  | Select a block side (raycast-based)                             |
| **Right Click** | Apply the currently selected block template to the clicked side |

### Block Manipulation

| Key           | Action                                                                    |
| ------------- | ------------------------------------------------------------------------- |
| **Space**     | Insert a block at the selector position, or grab/ungrab an existing block |
| **Backspace** | Remove the block at the selector position                                 |
| **Tab**       | Copy the block template from the selected side to the pool                |
| **Shift+Tab** | Copy the block template AND its properties                                |

***

## Placing Elements

### Blocks

1. Press **B** to open the Blocks Pool — a grid of available block templates from the current theme.
2. Select a block template from the pool.
3. Navigate with **WASD/EQ** to position the selector cursor in 3D space.
4. Press **Space** to place the block.

### Items

1. **Left-click** a block side to select it.
2. Press **I** to open the Items Pool.
3. Select an item template — it is automatically placed on the selected side.

### Enemies

1. **Left-click** a block side to select it.
2. Press **O** to open the Enemies Pool.
3. Select an enemy template — it is automatically placed on the selected side.

### Balls

1. **Left-click** a block side to select it.
2. Press **P** to open the Balls Pool.
3. Select a ball template — it is placed on the selected side.

### Decorations

1. **Left-click** a block side to select it.
2. Press **U** to open the Decorations Pool.
3. Select a decoration template — it is placed on the selected side.

***

## Configuring Elements

Press **V** on a selected side to open the Element Properties panel. From here you can configure:

* **Type** — Change the element template
* **Script** — Attach a Lua script to this element
* **Variables** — Set local script variables (key-value pairs)
* **Direction** — Set orientation (North/East/South/West)
* **Skin** — For balls with multiple skins
* **Order** — Ball execution order
* **Enemy Interactions** — For enemies, configure which hazards they interact with
* **Item Respawn** — Enable/disable respawn and set respawn time

***

## Level Properties

Press **Escape** to open the Main Menu, then select **Level Properties**:

* **Max Time** — Maximum time allowed for the level
* **Initial Time** — Starting time for the countdown
* **Lives** — Number of lives the player starts with
* **Hourglass** — Enable/disable the hourglass mechanic
* **Infinite Lives** — Give the player infinite lives
* **Script** — Attach a level-wide script

***

## Scripts in the Editor

### Creating Scripts

Press **C** to open the Script Editor. From here you can:

* **Create** new scripts — give each a unique name
* **Edit** existing scripts — modify Lua source code
* **Delete** scripts you no longer need

### Attaching Scripts

Each element (level, block, side, item, enemy, ball, decoration) can have a script attached:

1. Select the element
2. Press **V** to open properties
3. In the **Script** section, enter the script name or click **More Scripts** to browse
4. Set a **Script Tag** to identify this specific element instance
5. Configure **Script Variables** — key-value pairs accessible from the script

***

## Saving and Loading

### Save

1. Press **Escape** → **Save**
2. Enter a path like `folder/levelName`
3. The level is saved as a `.rqlevel` file with a thumbnail

### Load

1. Press **Escape** → **Load**
2. Browse directories and select a level
3. The editor rebuilds from the saved data

***

## Testing

Press **T** or use **Escape** → **Test Level** to play your level immediately. The game creates a virtual campaign with your level and lets you play it in the current editor session. Press **Escape** to return to the editor.

***

## Rotating the Level

Press **R** to open the rotation menu. You can rotate the entire level layout by 90-degree increments. The editor rebuilds all block positions and orientations.

***

## Score Info

The editor displays live score information based on the blocks, items, and enemies you place. This helps you balance the level's difficulty and reward structure.

***

## Complete Workflow Example

Here is a typical workflow for creating a simple level:

1. **Main Menu** → **Level Editor** → new level
2. Press **B** → select a floor block → press **Space** repeatedly to create a 5×5 floor
3. Press **E** to move selector up → place wall blocks around the perimeter
4. **Left-click** a side → press **P** → select ball template → ball is placed
5. **Left-click** another side → press **I** → select key template → key is placed
6. **Left-click** another side → press **O** → select enemy template → enemy is placed
7. Press **V** on the level → **Script** → enter `level_main`
8. Press **C** → **Create** → name it `level_main` → write your hooks
9. Press **T** to test → play through → press **Escape** to return
10. Press **Escape** → **Save** → enter path → done!

<Tip>
  The level editor saves your work in progress automatically between sessions. When you reopen the editor, it restores the previous state including camera position, selector position, and all placed elements.
</Tip>
