ballistic projectiles for cannons

This commit is contained in:
2026-06-26 17:11:25 -07:00
parent 4d267c7f5d
commit 4124f39632
3 changed files with 88 additions and 14 deletions
+8 -1
View File
@@ -232,7 +232,14 @@ update_towers :: proc(world: ^World, dt: f32) {
spawn_projectile(world, t.position, slot, damage)
case .Cannon:
if target := enemy_at_slot(world, slot); target != nil {
apply_tower_hit(world, target, damage)
len := distance(t.position, target.position)
if (len > 0.001) {
dir := Vec2 {
(target.position.x - t.position.x) / len,
(target.position.y - t.position.y) / len,
}
spawn_ballistic(world, t.position, dir, damage)
}
}
case .Ice:
if target := enemy_at_slot(world, slot); target != nil {