R-Type 0.1
Loading...
Searching...
No Matches
Enemy.hpp
1#pragma once
2
3#include <cstdint>
4#include <nlohmann/json.hpp>
5
6#include <Registry.hpp>
7
8namespace component {
17struct Enemy {
18 float health{100.0f};
19};
20
27inline void enemyFromJson(rtk::ecs::Registry &reg, std::size_t entity,
28 const nlohmann::json &data) {
29 component::Enemy enemy{};
30 enemy.health = data.value("health", 100.0f);
31
32 reg.get_components<component::Enemy>().insert_at(entity, enemy);
33}
34
36} // namespace component
void enemyFromJson(rtk::ecs::Registry &reg, std::size_t entity, const nlohmann::json &data)
Adds an Enemy to an entity from its blueprint data.
Definition Enemy.hpp:27
Marks an entity as a Bydos enemy.
Definition Enemy.hpp:17
float health
Remaining health points.
Definition Enemy.hpp:18