|
Aegis2D
Modular C++26 2D game engine for networked games
|
An entity that walks along waypoints, such as an enemy of a tower defense on the path found by NavGrid::find_path(). More...
#include <aegis2d/ecs/path_following.hpp>
Public Attributes | |
| std::vector< Vec2 > | waypoints {} |
| Points to walk through, in order, in logical pixels; the entity starts on the first one. | |
| float | speed = 0.0F |
| Speed along the path, in logical pixels per second. | |
| float | progress = 0.0F |
| Distance walked from the first waypoint, in logical pixels. | |
| bool | arrived = false |
true once the last waypoint is reached; the entity stops there. | |
An entity that walks along waypoints, such as an enemy of a tower defense on the path found by NavGrid::find_path().
follow_paths() adds speed * tick.delta() to progress each tick and puts the entity's Transform at that distance along the waypoints, corners included: the entity is where the distance says whatever the tick rate. progress tells who is ahead on the same path; when paths differ (one found again around a new tower), remaining() does. The entity needs no Velocity, which would move it off the path.
| bool aegis2d::ecs::PathFollower::arrived = false |
true once the last waypoint is reached; the entity stops there.
| float aegis2d::ecs::PathFollower::progress = 0.0F |
Distance walked from the first waypoint, in logical pixels.
| float aegis2d::ecs::PathFollower::speed = 0.0F |
Speed along the path, in logical pixels per second.
| std::vector<Vec2> aegis2d::ecs::PathFollower::waypoints {} |
Points to walk through, in order, in logical pixels; the entity starts on the first one.