reduce asteroid init

This commit is contained in:
Donald Ball 2025-11-20 21:07:12 -05:00
parent b2b70ee910
commit c1c774338e
2 changed files with 7 additions and 19 deletions

View file

@ -127,32 +127,18 @@ function love.update(dt)
if asteroid.stage > 1 then
local angle1 = love.math.random() * phys.tau
local angle2 = angle1 - phys.tau / 2
local stage = game.asteroids.stages[asteroid.stage - 1]
local radius = stage.radius
local speed = stage.speed
local sprite = stage.sprite
table.insert(state.asteroids, {
table.insert(state.asteroids, state.actors.asteroids.new({
x = asteroid.x,
y = asteroid.y,
angle = angle1,
stage = asteroid.stage - 1,
radius = radius,
speed = speed,
facing = math.random() * phys.tau,
spin = 0.1 + math.random() * 0.1,
sprite = sprite,
})
table.insert(state.asteroids, {
}))
table.insert(state.asteroids, state.actors.asteroids.new({
x = asteroid.x,
y = asteroid.y,
angle = angle2,
stage = asteroid.stage - 1,
radius = radius,
speed = speed,
facing = math.random() * phys.tau,
spin = 0.1 + math.random() * 0.1,
sprite = sprite,
})
}))
end
table.remove(state.asteroids, asteroidIndex)
break