Skip to main content

bounds Folder

Level boundary behavior components and systems. More...

Folders Index

foldercomponents
foldersystems

Files Index

filehelios/engine/mechanics/bounds/_module.ixx

Aggregate module for helios::engine::mechanics::bounds namespace. More...

filemechanics/bounds/registry.ixx

Component registration for bounds module. More...

Description

Level boundary behavior components and systems.

helios::engine::mechanics::bounds

Level boundary behavior components and systems.

This module handles entity behavior when interacting with level boundaries, including bouncing, wrapping, and despawning.

Submodules

SubmodulePurpose
components/Boundary behavior configuration per entity
systems/Boundary check and response logic

Key Classes

ClassPurpose
LevelBoundsBehaviorComponentStores behavior type (bounce, wrap, despawn) and restitution
LevelBoundsBehaviorSystemChecks bounds and applies configured behavior

Behavior Types

TypeEffect
BounceReflects velocity off boundary with restitution
WrapTeleports entity to opposite side
DespawnRemoves entity from world
ClampStops at boundary edge

Usage

 // Configure projectile to despawn at boundaries
 auto bullet = GameObjectFactory::gameObject()
  .withCollision([](auto& c) {
  c.levelBounds()
  .behavior(LevelBoundsBehavior::Despawn);
  })
  .make(true);
 
 // Configure enemy to bounce off boundaries
 auto enemy = GameObjectFactory::gameObject()
  .withCollision([](auto& c) {
  c.levelBounds()
  .behavior(LevelBoundsBehavior::Bounce)
  .restitution(0.8f); // 80% velocity retained
  })
  .make(true);
 
 // Add system to game loop
 gameLoop.phase(PhaseType::Main).addPass()
  .addSystem<LevelBoundsBehaviorSystem>(&gameWorld);


Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.