more game declarations

This commit is contained in:
Donald Ball 2025-11-14 21:38:46 -05:00
parent 89c3b42db2
commit ae1616299b

View file

@ -9,6 +9,8 @@ local function initGame()
bullet = {
timerLimit = 0.5,
radius = 5,
speed = 500,
time = 4,
},
},
asteroids = {
@ -105,9 +107,8 @@ function love.update(dt)
if bullet.timeLeft <= 0 then
table.remove(state.bullets, bulletIndex)
else
local bulletSpeed = 500
bullet.x = (bullet.x + math.cos(bullet.angle) * bulletSpeed * dt) % game.width
bullet.y = (bullet.y + math.sin(bullet.angle) * bulletSpeed * dt) % game.height
bullet.x = (bullet.x + math.cos(bullet.angle) * game.ship.bullet.speed * dt) % game.width
bullet.y = (bullet.y + math.sin(bullet.angle) * game.ship.bullet.speed * dt) % game.height
end
for asteroidIndex = #state.asteroids, 1, -1 do
local asteroid = state.asteroids[asteroidIndex]
@ -143,7 +144,7 @@ function love.update(dt)
x = state.ship.x + math.cos(state.ship.angle) * game.ship.radius,
y = state.ship.y + math.sin(state.ship.angle) * game.ship.radius,
angle = state.ship.angle,
timeLeft = 4,
timeLeft = game.ship.bullet.time,
})
end
end