title particles

This commit is contained in:
Martijn de Boer 2022-10-14 11:33:20 +02:00
parent 3f590d507f
commit 3f60135f02
No known key found for this signature in database
GPG key ID: 9D2E42402DD372D1
3 changed files with 40 additions and 1 deletions

View file

@ -9,6 +9,7 @@ multilily = lily.loadMulti({
{lily.newImage, "assets/ships/excalibur-iv.png"},
{lily.newImage, "assets/ships/decorator.png"},
{lily.newImage, "assets/ships/particle.png"},
{lily.newImage, "assets/particle.png"},
{lily.newImage, "assets/tiles/gf.png"}
})
multilily:onComplete(function(_, lilies)
@ -22,8 +23,9 @@ multilily:onComplete(function(_, lilies)
CaptainRobert.ship.image = lilies[8][1]
CaptainJohn.ship.image = lilies[9][1]
boosterParticle = lilies[10][1]
titleParticle = lilies[11][1]
tileGroundFull = lilies[11][1]
tileGroundFull = lilies[12][1]
windowWidth = love.graphics.getWidth()
windowHeight = love.graphics.getHeight()

BIN
assets/particle.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 181 B

View file

@ -14,15 +14,44 @@ function TitleScene:init()
introSound:play()
state = "in"
pSystem = love.graphics.newParticleSystem(titleParticle,128)
pSystem:setParticleLifetime(0,0.8)
pSystem:setLinearAcceleration(-6,20,6,25)
pSystem:setSpeed(40,50)
pSystem:setRotation(10,20)
pSystem:setSpin(10,20)
pSystem:setRadialAcceleration(5,20)
pSystem:setTangentialAcceleration(10,20)
pSystem:setSizeVariation(0.5)
pSystem:setSizes(1,0.9,0.9,0.8,0.6,0.5,0.3,0.1)
pSystem:setColors(
1,1,1,0.8,
1,1,1,0.8,
1,1,1,0.8,
1,1,1,0.7,
1,1,1,0.5,
1,1,1,0.3,
1,1,1,0.2,
1,1,1,0.1
)
pSystem:setDirection(315*(math.pi/180))
end
function TitleScene:update(dt)
pSystem:update(dt)
if progressDelta < progressTarget then
progressDelta = math.min( progressTarget, progressDelta + dt )
end
percentage = (progressDelta/progressTarget)
if state == "wait" then
pSystem:emit( 32 )
end
if state == "in" and progressDelta == progressTarget then
state = "wait"
progressDelta = 0
@ -42,6 +71,8 @@ function TitleScene:update(dt)
end
if state == "complete" then
pSystem:stop()
pSystem = nil
currentScene = GameScene
currentScene:init()
end
@ -60,7 +91,13 @@ function TitleScene:draw()
end
love.graphics.setColor(255,255,255, logoAlpha)
if pSystem ~= nil then
love.graphics.draw(pSystem, ((windowWidth - logoWidth) / 2) + 300, logoYpos + 8)
end
love.graphics.draw(gameLogo, (windowWidth - logoWidth) / 2, logoYpos )
end
function TitleScene:drawHud()