Enemies can be tagged as moving randomly, but it's very subtle.

This commit is contained in:
Zed A. Shaw 2025-01-09 14:25:34 -05:00
parent 222b39c403
commit d6916b675e
4 changed files with 11 additions and 3 deletions

View file

@ -19,6 +19,7 @@ namespace components {
struct Motion {
int dx;
int dy;
bool random=false;
DEFINE_SERIALIZABLE(Motion, dx, dy);
};
@ -68,6 +69,8 @@ namespace components {
world.set<EnemyConfig>(entity, {config["hearing_distance"]});
} else if(comp["type"] == "Combat") {
world.set<Combat>(entity, {config["hp"], config["damage"]});
} else if(comp["type"] == "Motion") {
world.set<Motion>(entity, {config["dx"], config["dy"], config["random"]});
} else {
dbc::sentinel(fmt::format("ITEM COMPONENT TYPE MISSING: {}",
std::string(comp["type"])));