constant rocket plume

This commit is contained in:
Donald Ball 2025-11-20 22:53:33 -05:00
parent 7eee00d7ea
commit e2f02985d3
2 changed files with 28 additions and 1 deletions

View file

@ -94,6 +94,22 @@ function actors.buildActors(game)
instance.engineSound = love.audio.newSource(instance.engineSound)
instance.engineSound:setVolume(0)
instance.engineSound:setLooping(true)
instance.rocketPlume = love.graphics.newParticleSystem(instance.rocketPlume)
instance.rocketPlume:setColors(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)
instance.rocketPlume:setSizes(1.0, 0.9, 0.1)
instance.rocketPlume:setEmissionRate(1000)
-- TODO probably governed most by thrust
instance.rocketPlume:setParticleLifetime(0.1, 0.25)
instance.rocketPlume:setEmissionArea('normal', 10, 10)
instance.rocketPlume:setSpeed(150, 300)
instance.rocketPlume:setRadialAcceleration(40, 80)
instance.rocketPlume:setLinearDamping(0, 0)
instance.rocketPlume:setDirection(phys.tau * 3 / 4)
instance.rocketPlume:setSpread(0)
instance.rocketPlume:setSizeVariation(0)
instance.rocketPlume:setSpin(0.5, 1)
instance.rocketPlume:setTangentialAcceleration(0, 0)
setmetatable(instance, ships_mt)
return instance
end
@ -115,7 +131,16 @@ function actors.buildActors(game)
width / 2,
height / 2
)
-- TODO rocket exhaust
--self.rocketPlume:setDirection(phys.tau * 3 / 4)
love.graphics.draw(self.rocketPlume,
0,
0,
(self.facing + phys.tau * 3 / 4) % phys.tau,
scale,
scale,
0,
height * 0.75
)
love.graphics.pop()
end

View file

@ -19,6 +19,7 @@ local function initGame()
sprite = love.graphics.newImage('resources/playerShip1_blue.png'),
maxThrust = 200,
engineSound = love.sound.newSoundData('resources/enginehum3.ogg'),
rocketPlume = love.graphics.newImage('resources/sparkle_cloud.png'),
},
asteroids = {
stages = {
@ -100,6 +101,7 @@ local function update(actor, dt)
end
function love.update(dt)
state.ship.rocketPlume:update(dt)
if state.controls.joystick ~= nil then
state.ship.throttle = state.controls.joystick:getGamepadAxis('triggerright')
if state.ship.throttle > 0 then