Scripting / Level & Utility
MapManager
Provides static spatial queries over the tile grid. Call from inside Tick() to validate positions, compute movement offsets, and find start/end tiles.
Static Properties
| Property | Type | Description |
|---|---|---|
cellSize | float | World-unit size of one grid cell, auto-detected from tile sprites at startup. Use this to calculate movement offsets. |
startTile | PathTile | The tile the player starts on at the beginning of each run. |
endTile | PathTile | The goal tile. The runner checks whether the player is here to determine level success. |
Static Methods
| Method | Returns | Description |
|---|---|---|
GetTile(Vector3 position) | PathTile | Returns the PathTile at the given world position, or null if no tile exists there. |
CellPosition(Vector3 position) | Vector2 | Snaps a world position to the nearest grid cell center. |
Common Patterns
// Move one cell in the instruction's direction Vector2 target = ctx.player.position + direction.AsVector2() * MapManager.cellSize; // Move two cells (e.g. Jump) Vector2 target = ctx.player.position + direction.AsVector2() * MapManager.cellSize * 2; // Check if the tile at a position exists PathTile tile = MapManager.GetTile(target); if (tile == null) { /* no tile there */ } // Check if a position is walkable (tile + no obstacles) if (!ctx.player.ValidatePosition(target)) { /* blocked */ }