AI is now mostly working. Enemies will attack the player, and some of them are marked as not tough so they'll run away when they get low health.

This commit is contained in:
Zed A. Shaw 2025-03-15 11:43:46 -04:00
parent c4e01775bc
commit 75db188dc6
6 changed files with 56 additions and 27 deletions

View file

@ -44,8 +44,12 @@ namespace components {
Config bosses;
};
struct EnemyConfig {
struct Personality {
int hearing_distance = 10;
bool tough = true;
};
struct EnemyAI {
std::string ai_script;
std::string ai_start_name;
std::string ai_goal_name;
@ -142,8 +146,8 @@ namespace components {
ENROLL_COMPONENT(Weapon, damage);
ENROLL_COMPONENT(Loot, amount);
ENROLL_COMPONENT(Position, location.x, location.y);
ENROLL_COMPONENT(EnemyConfig, hearing_distance,
ai_script, ai_start_name, ai_goal_name);
ENROLL_COMPONENT(EnemyAI, ai_script, ai_start_name, ai_goal_name);
ENROLL_COMPONENT(Personality, hearing_distance, tough);
ENROLL_COMPONENT(Motion, dx, dy, random);
ENROLL_COMPONENT(Combat, hp, max_hp, damage, dead);
ENROLL_COMPONENT(Device, config, events);