Now have all four screens showing up when needed, but now need to a way to restart the game.
This commit is contained in:
parent
d03020cfef
commit
903fad871f
11 changed files with 110 additions and 26 deletions
|
|
@ -131,7 +131,7 @@ namespace components {
|
|||
int ap = 0;
|
||||
|
||||
/* NOTE: This is used to _mark_ entities as dead, to detect ones that have just died. Don't make attack automatically set it.*/
|
||||
bool dead = false;
|
||||
bool has_died = false;
|
||||
|
||||
bool less_than(int level);
|
||||
int attack(Combat &target);
|
||||
|
|
|
|||
|
|
@ -195,13 +195,14 @@ void System::death() {
|
|||
|
||||
world.query<Combat>([&](auto ent, auto &combat) {
|
||||
// bring out yer dead
|
||||
if(combat.is_dead() && !combat.dead) {
|
||||
combat.dead = true;
|
||||
if(!combat.has_died && combat.is_dead()) {
|
||||
combat.has_died = true;
|
||||
if(ent != player.entity) {
|
||||
// we won't change out the player's components later
|
||||
dead_things.push_back(ent);
|
||||
}
|
||||
// we need to send this event for everything that dies
|
||||
dbc::log("SENT DEATH!");
|
||||
world.send<game::Event>(game::Event::DEATH, ent, {});
|
||||
} else if(combat.almost_dead()) {
|
||||
// if enemies are below 50% health they are marked with bad health
|
||||
|
|
@ -304,7 +305,7 @@ void System::collision() {
|
|||
for(auto entity : nearby) {
|
||||
if(world.has<Combat>(entity)) {
|
||||
auto combat = world.get<Combat>(entity);
|
||||
if(!combat.dead) {
|
||||
if(!combat.has_died) {
|
||||
combat_count++;
|
||||
world.send<game::Event>(game::Event::COMBAT_START, entity, entity);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue