From 5d6c97d086adda3b8659f1bf7cbe1634754aa43c Mon Sep 17 00:00:00 2001 From: Martijn de Boer Date: Thu, 13 Oct 2022 19:34:18 +0200 Subject: [PATCH] particles --- assets.lua | 4 ++- assets/ships/particle.png | Bin 0 -> 316 bytes scene/game.lua | 58 ++++++++++++++++++++++++++++++-------- 3 files changed, 49 insertions(+), 13 deletions(-) create mode 100644 assets/ships/particle.png diff --git a/assets.lua b/assets.lua index b041cdd..75a23ec 100644 --- a/assets.lua +++ b/assets.lua @@ -7,7 +7,8 @@ multilily = lily.loadMulti({ {lily.newImage, "assets/captains/john-danger.png"}, {lily.newImage, "assets/ships/blackstar-5.png"}, {lily.newImage, "assets/ships/excalibur-iv.png"}, - {lily.newImage, "assets/ships/decorator.png"} + {lily.newImage, "assets/ships/decorator.png"}, + {lily.newImage, "assets/ships/particle.png"} }) multilily:onComplete(function(_, lilies) gameLogo = lilies[1][1] @@ -19,6 +20,7 @@ multilily:onComplete(function(_, lilies) CaptainSteve.ship.image = lilies[7][1] CaptainRobert.ship.image = lilies[8][1] CaptainJohn.ship.image = lilies[9][1] + boosterParticle = lilies[10][1] windowWidth = love.graphics.getWidth() windowHeight = love.graphics.getHeight() diff --git a/assets/ships/particle.png b/assets/ships/particle.png new file mode 100644 index 0000000000000000000000000000000000000000..e6003a5852682af844e1d13e7eea5511d8a8171f GIT binary patch literal 316 zcmV-C0mJ@@P)A){!wlGY$j;&%6ndy{8y z@;O>x!Ab7o;HV{)Y!RJAFxUr3C^We?4r+~O{y3at(#Yw_ark_9ei^62?R0xdmSq4K zO`xWMw3CISrh#T(fWBRqgHd6|sc^@Wk!O_4mRN5f|7qH{s0Mx^!v|${y1nH3_QO4k z4n3nXjB3f0w-l#}}{0Qdq)oN|4{S2QI6 O0000 (1-axisMargin)) or (not (hAxis2 == nil) and hAxis2 > (1-axisMargin)) or love.joystick.isDown(1, 4) if isUp and isLeft then - rotation = 315 + currentPlayer.rot = 315 + particleRot = 45 elseif isUp and isRight then - rotation = 45 + currentPlayer.rot = 45 + particleRot = 135 elseif isUp then - rotation = 0 + currentPlayer.rot = 0 + particleRot = 90 elseif isDown and isLeft then - rotation = 225 + currentPlayer.rot = 225 + particleRot = 315 elseif isDown and isRight then - rotation = 135 + currentPlayer.rot = 135 + particleRot = 225 elseif isDown then - rotation = 180 + currentPlayer.rot = 180 + particleRot = 270 elseif isLeft then - rotation = 270 + currentPlayer.rot = 270 + particleRot = 0 elseif isRight then - rotation = 90 + currentPlayer.rot = 90 + particleRot = 180 end - currentPlayer.rot = rotation - if isUp or isDown or isLeft or isRight then currentPlayer.acc = currentPlayer.acc + currentPlayer.accIncr elseif currentPlayer.acc > 0 then @@ -108,6 +137,11 @@ function GameScene:updateInput(dt) currentPlayer.acc = math.clamp(0, currentPlayer.acc, 1) + if currentPlayer.acc > 0 then + pSystem:setDirection(particleRot*(math.pi/180)) + pSystem:emit( 64 * currentPlayer.acc ) + end + if isUp then currentPlayer.py = currentPlayer.py - (currentPlayer.speed*currentPlayer.acc) end