Tweak building health, fix damage dealing
This commit is contained in:
@@ -91,9 +91,9 @@ ecs_entity_t placeBuilding(Game *game, BuildingType type,
|
|||||||
bool hasCollision = true;
|
bool hasCollision = true;
|
||||||
|
|
||||||
Health health = {
|
Health health = {
|
||||||
.startHP = 100.0f,
|
.startHP = 500.0f,
|
||||||
.hp = 100.0f,
|
.hp = 500.0f,
|
||||||
.lastChanged = -1.0f,
|
.lastChanged = 1000.0f,
|
||||||
};
|
};
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case BUILDING_KEEP:
|
case BUILDING_KEEP:
|
||||||
@@ -113,7 +113,7 @@ ecs_entity_t placeBuilding(Game *game, BuildingType type,
|
|||||||
.elapsed = 0.0f,
|
.elapsed = 0.0f,
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
health.startHP = 1000.0f;
|
health.startHP = 5000.0f;
|
||||||
health.hp = health.startHP;
|
health.hp = health.startHP;
|
||||||
break;
|
break;
|
||||||
case BUILDING_WAREHOUSE:
|
case BUILDING_WAREHOUSE:
|
||||||
@@ -146,6 +146,8 @@ ecs_entity_t placeBuilding(Game *game, BuildingType type,
|
|||||||
.elapsed = 0.0f
|
.elapsed = 0.0f
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
health.startHP = 2000.0f;
|
||||||
|
health.hp = health.startHP;
|
||||||
break;
|
break;
|
||||||
case BUILDING_TOWER: {
|
case BUILDING_TOWER: {
|
||||||
ecs_entity_t mage = entityCreateEmpty();
|
ecs_entity_t mage = entityCreateEmpty();
|
||||||
|
|||||||
@@ -898,7 +898,7 @@ void imguiRender(float dt, void *userData) {
|
|||||||
resources.wood = wood;
|
resources.wood = wood;
|
||||||
resources.food = food;
|
resources.food = food;
|
||||||
resources.gold = gold;
|
resources.gold = gold;
|
||||||
//game->playerResources[game->player] = resources;
|
game->playerResources[game->player] = resources;
|
||||||
igText("Pop: %lld", resources.pop);
|
igText("Pop: %lld", resources.pop);
|
||||||
igText("Pop Capacity: %lld", resources.popCapacity);
|
igText("Pop Capacity: %lld", resources.popCapacity);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ void damageEvent(ecs_entity_t entity, DamageEvent event) {
|
|||||||
ecs_remove(ECS, entity, Health);
|
ecs_remove(ECS, entity, Health);
|
||||||
ecs_remove(ECS, entity, Unit);
|
ecs_remove(ECS, entity, Unit);
|
||||||
ecs_remove(ECS, entity, Building);
|
ecs_remove(ECS, entity, Building);
|
||||||
} else {
|
} else if (health->hp <= 0){
|
||||||
// No animation, delete right away
|
// No animation, delete right away
|
||||||
ecs_delete(ECS, entity);
|
ecs_delete(ECS, entity);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user