Partial tower implementation
This commit is contained in:
@@ -146,6 +146,44 @@ ecs_entity_t placeBuilding(Game *game, BuildingType type,
|
||||
}
|
||||
});
|
||||
break;
|
||||
case BUILDING_TOWER: {
|
||||
ecs_entity_t mage = entityCreateEmpty();
|
||||
const Vector2 mageSize = { 8.0f, 16.0f };
|
||||
Vector2 magePos = {
|
||||
pos.x + (size.x - mageSize.x) * 0.5f,
|
||||
pos.y - size.y * 0.5f
|
||||
};
|
||||
ecs_set_ptr(ECS, mage, Position, &magePos);
|
||||
ecs_set_ptr(ECS, mage, Size, &mageSize);
|
||||
ecs_set(ECS, mage, Rotation, { 0 });
|
||||
ecs_set(ECS, mage, TextureRegion, {
|
||||
tileset->tiles,
|
||||
getTextureRect(getEntityTile(ENTITY_MAGE))
|
||||
});
|
||||
ecs_set(ECS, mage, Animation, {
|
||||
.entityType = ENTITY_MAGE,
|
||||
.animType = ANIM_IDLE,
|
||||
|
||||
.sequence = entityGetAnimationSequence(ENTITY_MAGE, ANIM_IDLE),
|
||||
.tileset = tileset,
|
||||
.curFrame = 0,
|
||||
.elapsed = 0.0f
|
||||
});
|
||||
ecs_set(ECS, mage, DrawLayer, { 1 });
|
||||
|
||||
ecs_set(ECS, building, AttachedEntity, {mage});
|
||||
ecs_set(ECS, building, Tower, {
|
||||
.range = 46.0f,
|
||||
.minDamage = 40.0f,
|
||||
.maxDamage = 80.0f,
|
||||
.damageFalloff = 8.0f,
|
||||
.damageRadius = 28.0f,
|
||||
.projectileSpeed = 10.0f,
|
||||
.fireCooldown = 1.2f,
|
||||
.fireElapsed = 0.0f,
|
||||
});
|
||||
break;
|
||||
}
|
||||
case BUILDING_HOUSE_01:
|
||||
case BUILDING_HOUSE_02:
|
||||
case BUILDING_HOUSE_03:
|
||||
|
||||
Reference in New Issue
Block a user