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;
|
||||
|
||||
Health health = {
|
||||
.startHP = 100.0f,
|
||||
.hp = 100.0f,
|
||||
.lastChanged = -1.0f,
|
||||
.startHP = 500.0f,
|
||||
.hp = 500.0f,
|
||||
.lastChanged = 1000.0f,
|
||||
};
|
||||
switch (type) {
|
||||
case BUILDING_KEEP:
|
||||
@@ -113,7 +113,7 @@ ecs_entity_t placeBuilding(Game *game, BuildingType type,
|
||||
.elapsed = 0.0f,
|
||||
}
|
||||
});
|
||||
health.startHP = 1000.0f;
|
||||
health.startHP = 5000.0f;
|
||||
health.hp = health.startHP;
|
||||
break;
|
||||
case BUILDING_WAREHOUSE:
|
||||
@@ -146,6 +146,8 @@ ecs_entity_t placeBuilding(Game *game, BuildingType type,
|
||||
.elapsed = 0.0f
|
||||
}
|
||||
});
|
||||
health.startHP = 2000.0f;
|
||||
health.hp = health.startHP;
|
||||
break;
|
||||
case BUILDING_TOWER: {
|
||||
ecs_entity_t mage = entityCreateEmpty();
|
||||
|
||||
@@ -898,7 +898,7 @@ void imguiRender(float dt, void *userData) {
|
||||
resources.wood = wood;
|
||||
resources.food = food;
|
||||
resources.gold = gold;
|
||||
//game->playerResources[game->player] = resources;
|
||||
game->playerResources[game->player] = resources;
|
||||
igText("Pop: %lld", resources.pop);
|
||||
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, Unit);
|
||||
ecs_remove(ECS, entity, Building);
|
||||
} else {
|
||||
} else if (health->hp <= 0){
|
||||
// No animation, delete right away
|
||||
ecs_delete(ECS, entity);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user