more game declarations
This commit is contained in:
parent
89c3b42db2
commit
ae1616299b
1 changed files with 5 additions and 4 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue