From c12d3f7bf00e9a3acbb024aa8a9592060d52d15c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juhani=20Krekel=C3=A4?= Date: Fri, 2 Jun 2023 17:58:24 +0300 Subject: [PATCH] Fix location calculation for explosions destroying things --- bundle/main.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bundle/main.lua b/bundle/main.lua index c9317b3..536d668 100644 --- a/bundle/main.lua +++ b/bundle/main.lua @@ -198,7 +198,7 @@ function updateExplosions(dt) -- Destroy missiles within range for _, missile in ipairs(missiles) do local dx = missile.x - explosion.x - local dy = missile.x - explosion.x + local dy = missile.y - explosion.y local distance = math.sqrt(dx * dx + dy * dy) if distance < explosion.radius then missile.alive = false @@ -211,7 +211,7 @@ function updateExplosions(dt) -- Destroy cities within range for _, city in ipairs(cities) do local dx = city.x - explosion.x - local dy = city.x - explosion.x + local dy = city.y - explosion.y local distance = math.sqrt(dx * dx + dy * dy) if distance < explosion.radius + city_radius then city.alive = false