Pattern Movement System
Source file: client/engine/systems/systems_functions/PaternMovementSystem.cpp
Purpose: Apply movement patterns to entities (enemies, special projectiles) according to the configured PatternMovement type.
Components used:
Pattern Movement System
Source file: client/engine/systems/systems_functions/PaternMovementSystem.cpp
Purpose: Apply movement patterns to entities (enemies, special projectiles) according to the configured PatternMovement type.
Components used:
Behavior
- Increments
patternMovement.elapsedwithdt, then dispatches to the function matchingPatternType:- Straight: sets
vx/vy = baseDir * baseSpeed; kills entity if far outside bounds (x←100/x→2000/y←100/y→1200). - SineHorizontal / ZigZagHorizontal: advances in X with base speed and oscillates in Y (continuous sine or sign-based zigzag).
- SineVertical / ZigZagVertical: advances in Y with base speed and oscillates in X.
- Wave: combines sine offsets on X and Y added to base velocity.
- Waypoints: moves toward each waypoint until within
waypointThreshold, then cycles. - FollowPlayer: finds the nearest player if
targetEntityId == -1, then steers toward it; resets if the target vanishes. - Circular: writes
transformto follow a circle aroundspawnPosusingradiusandbaseSpeed(elapseddrives the angle).
- Straight: sets
- Each pattern may kill the entity if it exits extended bounds.
Main signature
void PaternMovementSystem(Eng::registry ®, const float dt,
Eng::sparse_array<Com::Transform> &transforms,
Eng::sparse_array<Com::Velocity> &velocities,
Eng::sparse_array<Com::PatternMovement> &patern_movements);