From 78cd6176a884998d88d6856609f25978ebcfcb2d Mon Sep 17 00:00:00 2001 From: Donald Ball Date: Fri, 14 Nov 2025 17:01:03 -0500 Subject: [PATCH] splitting asteroids --- main.lua | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/main.lua b/main.lua index 82e1b94..63617ae 100644 --- a/main.lua +++ b/main.lua @@ -72,6 +72,18 @@ function love.update(dt) local asteroid = asteroids[asteroidIndex] if areCirclesIntersecting(bullet.x, bullet.y, bulletRadius, asteroid.x, asteroid.y, asteroidRadius) then table.remove(bullets, bulletIndex) + local angle1 = love.math.random() * (2 * math.pi) + local angle2 = (angle1 - math.pi) % (2 * math.pi) + table.insert(asteroids, { + x = asteroid.x, + y = asteroid.y, + angle = angle1, + }) + table.insert(asteroids, { + x = asteroid.x, + y = asteroid.y, + angle = angle2, + }) table.remove(asteroids, asteroidIndex) break end