Aegis2D
Modular C++26 2D game engine for networked games
Loading...
Searching...
No Matches
path_following.hpp File Reference

Path following: entities that walk along waypoints at a steady speed, and tell when they reach the end. More...

#include <aegis2d/core/event_bus.hpp>
#include <aegis2d/core/math.hpp>
#include <aegis2d/ecs/components.hpp>
#include <aegis2d/ecs/entity.hpp>
#include <aegis2d/ecs/registry.hpp>
#include <aegis2d/ecs/system.hpp>
#include <algorithm>
#include <cmath>
#include <span>
#include <vector>

Go to the source code of this file.

Classes

struct  aegis2d::ecs::PathFollower
 An entity that walks along waypoints, such as an enemy of a tower defense on the path found by NavGrid::find_path(). More...
 
struct  aegis2d::ecs::PathEnded
 An entity that reached the last waypoint of its path. More...
 

Namespaces

namespace  aegis2d
 Root namespace of the engine.
 
namespace  aegis2d::ecs
 Entity-Component-System used by client and server.
 

Functions

float aegis2d::ecs::path_length (std::span< const Vec2 > waypoints) noexcept
 Length of a path.
 
Vec2 aegis2d::ecs::point_along (std::span< const Vec2 > waypoints, float distance) noexcept
 Point at a distance along a path.
 
float aegis2d::ecs::remaining (const PathFollower &follower) noexcept
 Distance a follower still has to walk.
 
void aegis2d::ecs::follow_paths (Registry &registry, const Tick &tick, std::vector< Entity > &arrived)
 Moves every PathFollower along its path for one tick and lists those that arrived.
 
void aegis2d::ecs::publish_path_ends (core::EventBus &events, const Registry &registry, std::span< const Entity > arrived)
 Publishes a PathEnded for each entity that arrived this tick.
 

Detailed Description

Path following: entities that walk along waypoints at a steady speed, and tell when they reach the end.