ballistic projectiles for cannons
This commit is contained in:
+8
-1
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user