This commit is contained in:
Donald Ball 2025-11-14 16:22:01 -05:00
parent 419f858b1b
commit 5e47a5773c

View file

@ -11,6 +11,8 @@ function love.load()
shipRadius = 30
bullets = {}
bulletTimerLimit = 0.5
bulletTimer = bulletTimerLimit
end
function love.update(dt)
@ -43,10 +45,11 @@ function love.update(dt)
bullet.y = (bullet.y + math.sin(bullet.angle) * bulletSpeed * dt) % arenaHeight
end
end
end
function love.keypressed(key)
if key == 's' then
bulletTimer = bulletTimer + dt
if love.keyboard.isDown('s') then
if bulletTimer >= bulletTimerLimit then
bulletTimer = 0
table.insert(bullets, {
x = shipX + math.cos(shipAngle) * shipRadius,
y = shipY + math.sin(shipAngle) * shipRadius,
@ -55,6 +58,7 @@ function love.keypressed(key)
})
end
end
end
function love.draw()
for y = -1, 1 do