Implemented configurable randomization in the world builder, and then got the beginning of devices to work for the next part of going down a level through stairs.
This commit is contained in:
parent
7acbd0379f
commit
d2162910f6
10 changed files with 73 additions and 36 deletions
|
@ -6,6 +6,10 @@
|
|||
#include "config.hpp"
|
||||
|
||||
namespace components {
|
||||
struct Device {
|
||||
bool active = 0;
|
||||
};
|
||||
|
||||
struct Player {
|
||||
DinkyECS::Entity entity;
|
||||
DEFINE_SERIALIZABLE(Player, entity);
|
||||
|
@ -38,6 +42,7 @@ namespace components {
|
|||
Config enemies;
|
||||
Config items;
|
||||
Config tiles;
|
||||
Config devices;
|
||||
};
|
||||
|
||||
struct EnemyConfig {
|
||||
|
@ -77,6 +82,8 @@ namespace components {
|
|||
world.set<Curative>(entity, {config["hp"]});
|
||||
} else if(comp["type"] == "Motion") {
|
||||
world.set<Motion>(entity, {config["dx"], config["dy"], config["random"]});
|
||||
} else if(comp["type"] == "Device") {
|
||||
world.set<Device>(entity, {config["active"]});
|
||||
} else {
|
||||
dbc::sentinel(fmt::format("ITEM COMPONENT TYPE MISSING: {}",
|
||||
std::string(comp["type"])));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue