Skip to content

Reusable Map Components

Ethan Harvey edited this page Sep 1, 2026 · 1 revision

The map collision system uses reusable components and factory methods to create the physical behaviour associated with different map tiles. This keeps collision creation separate from the level-specific logic and allows the same components to be used across multiple levels.

ObstacleFactory provides methods for creating different types of map collision entities:

  • createSolidTile() — Creates a solid tile collider that prevents physics-enabled entities from passing through it.
  • createPlatformTile() — Creates a platform collider that allows the player to stand on the tile.
  • createHazardTile() — Creates a hazard collider that can detect contact with entities and trigger effects such as damage.
  • createWall() — Pre-existing method used to create larger static wall colliders around or within the game area.

These methods build on the existing entity and physics component architecture, allowing collision objects to be created consistently without duplicating physics setup throughout the game area classes.

The collision type specified by the map determines which factory method is used. For example, a tile marked as SOLID will use the solid tile creation method, while a PLATFORM or HAZARD tile will use its corresponding method. This makes the system extensible, as additional tile behaviours can be added by introducing a new collision type and corresponding factory method without significantly changing the level-loading process.

Clone this wiki locally