aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/api/AI.h
diff options
context:
space:
mode:
authormax-001 <maxsmits21@kpnmail.nl>2024-12-06 17:14:00 +0100
committermax-001 <maxsmits21@kpnmail.nl>2024-12-06 17:14:00 +0100
commit33a072db28d71ba65e59f9491abd42dbf9695fc4 (patch)
treedc911454f5cc98198ac55370bb1bffd6aee3b053 /src/crepe/api/AI.h
parent0d0943d23364d7110f0232e3564f4ea63af13db2 (diff)
Implemented path_follow
Diffstat (limited to 'src/crepe/api/AI.h')
-rw-r--r--src/crepe/api/AI.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/crepe/api/AI.h b/src/crepe/api/AI.h
index d4bd9d3..35b8998 100644
--- a/src/crepe/api/AI.h
+++ b/src/crepe/api/AI.h
@@ -36,6 +36,8 @@ public:
if (on(PATH_FOLLOW)) flags ^= PATH_FOLLOW;
}
+ void add_path_node(vec2 node) { path.push_back(node); }
+
public:
float max_force;
@@ -47,9 +49,21 @@ public:
float square_flee_panic_distance = 200.0f * 200.0f;
// The deceleration rate for the arrive behavior (higher values will make the entity decelerate faster (less overshoot))
float arrive_deceleration = 40.0f;
+ // The path to follow
+ std::vector<vec2> path;
+ // The distance from the path node at which the entity will move to the next node
+ float path_node_distance = 400.0f;
+ // Looping behavior for the path
+ bool path_loop = true;
private:
+ // The flags for the behaviors
int flags = 0;
+ // The current path index
+ size_t path_index = 0;
+
+ // The AISystem is the only class that can access the private members of AI
+ friend class AISystem;
};
} // namespace crepe