add ice towers - no projectiles, no button
This commit is contained in:
@@ -13,6 +13,7 @@ Tower :: struct {
|
||||
Tower_Kind :: enum {
|
||||
Archer,
|
||||
Cannon,
|
||||
Ice,
|
||||
}
|
||||
|
||||
Tower_Archetype :: struct {
|
||||
@@ -44,6 +45,15 @@ TOWER_ARCHETYPES: [Tower_Kind]Tower_Archetype = {
|
||||
footprint_w = 2,
|
||||
footprint_h = 2,
|
||||
},
|
||||
.Ice = {
|
||||
kind = .Ice,
|
||||
range = 85,
|
||||
damage = 6,
|
||||
fire_rate = 0.55,
|
||||
cost = 65,
|
||||
footprint_w = 1,
|
||||
footprint_h = 1,
|
||||
},
|
||||
}
|
||||
|
||||
rects_overlap :: proc(
|
||||
@@ -166,6 +176,10 @@ update_towers :: proc(world: ^World, dt: f32) {
|
||||
if target := enemy_at_slot(world, slot); target != nil {
|
||||
apply_tower_hit(world, target, arch.damage)
|
||||
}
|
||||
case .Ice:
|
||||
if target := enemy_at_slot(world, slot); target != nil {
|
||||
apply_ice_hit(world, target, arch.damage)
|
||||
}
|
||||
}
|
||||
t.cooldown = arch.fire_rate
|
||||
}
|
||||
@@ -179,6 +193,11 @@ apply_tower_hit :: proc(world: ^World, target: ^Enemy, damage: int) {
|
||||
}
|
||||
}
|
||||
|
||||
apply_ice_hit :: proc(world: ^World, target: ^Enemy, damage: int) {
|
||||
apply_tower_hit(world, target, damage)
|
||||
if target.active do target.slow_timer = ICE_SLOW_DURATION
|
||||
}
|
||||
|
||||
enemy_at_slot :: proc(world: ^World, slot: int) -> ^Enemy {
|
||||
if slot < 0 || slot >= MAX_ENEMIES do return nil
|
||||
|
||||
|
||||
Reference in New Issue
Block a user