From e355e5d3fed91528f1eaa8c764fc9e0941f54dba Mon Sep 17 00:00:00 2001 From: Martijn de Boer Date: Thu, 13 Oct 2022 18:18:27 +0200 Subject: [PATCH] player ship --- assets.lua | 8 ++- assets/captains/john-danger.png | Bin 3277 -> 3966 bytes assets/ships/blackstar-5.png | Bin 0 -> 397 bytes assets/ships/blackstar-5.psd | Bin 0 -> 24389 bytes assets/ships/decorator.png | Bin 0 -> 397 bytes assets/ships/excalibur-iv.png | Bin 0 -> 401 bytes captain/johndanger.lua | 3 +- captain/player.lua | 11 ++++ captain/robertdavis.lua | 3 +- captain/stevelayer.lua | 3 +- main.lua | 8 +++ scene/game.lua | 106 +++++++++++++++++++++++++++++--- scene/load.lua | 4 +- scene/title.lua | 1 + ship/blackstar5.lua | 7 +++ ship/decorator.lua | 7 +++ ship/excaliburiv.lua | 7 +++ ship/ship.lua | 6 ++ vendor/math.lua | 64 +++++++++++++++++++ 19 files changed, 225 insertions(+), 13 deletions(-) create mode 100644 assets/ships/blackstar-5.png create mode 100644 assets/ships/blackstar-5.psd create mode 100644 assets/ships/decorator.png create mode 100644 assets/ships/excalibur-iv.png create mode 100644 ship/blackstar5.lua create mode 100644 ship/decorator.lua create mode 100644 ship/excaliburiv.lua create mode 100644 ship/ship.lua create mode 100644 vendor/math.lua diff --git a/assets.lua b/assets.lua index 548908c..b041cdd 100644 --- a/assets.lua +++ b/assets.lua @@ -4,7 +4,10 @@ multilily = lily.loadMulti({ {lily.newImage, "assets/hud.png"}, {lily.newImage, "assets/captains/steve-layer.png"}, {lily.newImage, "assets/captains/robert-davis.png"}, - {lily.newImage, "assets/captains/john-danger.png"} + {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"} }) multilily:onComplete(function(_, lilies) gameLogo = lilies[1][1] @@ -13,6 +16,9 @@ multilily:onComplete(function(_, lilies) CaptainSteve.image = lilies[4][1] CaptainRobert.image = lilies[5][1] CaptainJohn.image = lilies[6][1] + CaptainSteve.ship.image = lilies[7][1] + CaptainRobert.ship.image = lilies[8][1] + CaptainJohn.ship.image = lilies[9][1] windowWidth = love.graphics.getWidth() windowHeight = love.graphics.getHeight() diff --git a/assets/captains/john-danger.png b/assets/captains/john-danger.png index d4f4c270e9bc542adc58610108d6a1af5e36be76..204c968c38a555017facd299743c2b2379a1c09e 100644 GIT binary patch delta 3947 zcmV-x50voD8U7xSIDZc?Nkl%e{3Abb;mzPS&}8yre>C^3&c_E&!H>;k}vZ#g-t`h4P=1xvSa48(bMh);D3$XEvEo(2Hpo&KfizX zAC0_v>>GPNbAR{er6qq^N^6~v)}`LQ!VWm}Cpjm-7KYEwOrxE4GJJpn$+YSOuV(_l zs-b>*Wry>j!NH+V1NYgT4rmZ|Cqf7i0<=bJjSymfYU)Jg_{gh|xuvlaz?$JPeg;(k zPnv+!&TYWWIVb-laF^Zb0H9HzB>)0K<^kGlyVu$KaDVSB+N&^GF1`SVzc@3^WsD}h zOQ0D^fh;F2n+7=TIQzb^`@70lACi{5xigzXD<7qN0D7_oGz#19MSB&5-C6gGFhZJ~ z82Ng!IQpH@)9&8~UC$@~YdJMwxdd?Q?jh&NLSgggL&gEdi)ZL7Y(hv20IhuN&c5Ik zg;#NdYkvjEP%}7r;-wiWt@-idnXe8X8~YaUcKAoj#XKyd0GxL0q3!+ObaJ^~w^YKi zIw-j_09bMZeT7Zf(lIs=FsijSFKdNHMMAS>&2$73;Odc)zyAHCEPW=2^VT_*)|* z!=D6R1Lo9)#VA93)@sstWi*8bB;e{zz*D|DPoc2cs4cZn7iT)I{>{&0ngIygW?;)s zPMti$#CVb3z5<{S((16}hTGlJ*qQijFMmY&t{T&_!>N0=6dZ6nuo~Kb4UDP+XkA7i z(ON~J4QTKILF3>@$IPMDUf4DRJNClS=OQO5kZpa1O!CE)o3S>UgT-4Y-~l03kX7A}#pJfqkz4>yk6tDy8)S zw*Zqv{q3LXD{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CxKuz_);_z=L3y)B0uJhJSKURj=1LAr{{pRx}NS_ zxUjLNst<|CcL0+t*j{b(GBSil_%}u5I&eiqpTj)S;xS1|S)#q>63yM{gN1{Z!8xe{ zyaeo++1mR0=JBnq3&(*q5jiO$YbA4iEA?L++D7D7!|}@^63pV4U0uKBkO>U^$bX`H zz91=kf1$E+FHi!N*zIXeNb&gy@Pvr`)NHo(KHz@fq=+18)(pbq9!Q#F+(N{_E`$7= ztE$ff&w_j%?DoDO-yq-1nE0@8z}(Dk0beE6>%XY$=?lQWi^z4e_D2vqB+JcJbuMX_ zcb?BBFeSGUZeaE`Rrfcps{YE%o_`0v0o*<$ep@=s-we%xo4{9qF96$>t8Vz<9}|)9 z5|J~&3DUND>k-9w=VrDo!gY+RqWZU@?n@TKi=ui3xV_XTtVF|JGdcuvybX-MCctSk zdssw%1o)vC!(%bV2PDx+((`@CNLF8K9*e(2nl8O8qW|Ek>dU}io7pSC>wolqIkJ1g z+i!TJ5I8gi^k@PcZ@76FcsKCw5d3$G$o;@+k~bV{)^D5HO%Zuj)m<^OzX$$Nox4iH z75jP!VrZ1Uw;b|q`Q0ESm%a_WLi)MOSIz7l&Q2^i?toU2ZT;E#*Q5i>i|B*JY=kKNq_ZkokAB5vPL zg0C)o=e6UjzzT5G%;vytv-pO^_-a*8|HI6#n%Naq_jNP73cO-wubJ5`5#4DgJ$Ipz zmTwdA|LBjWg{I`0?U>m%se|06D3597{*=3-@Dt!D*fF~BdmDZ|J}!`>#xyrc_`H3# nCrwDgo&g>Jc?|e|n(+T`cYNLJzu4K$00000NkvXXu0mjf1=MfY diff --git a/assets/ships/blackstar-5.png b/assets/ships/blackstar-5.png new file mode 100644 index 0000000000000000000000000000000000000000..5945beea7a73d58b34b92de949c16fbffe433999 GIT binary patch literal 397 zcmV;80doF{P)UB{03u1cflsW+XH1;4*r%>eoQil7d-<(0<4>FE`qE$D#06xZkmQErPh+$ zB7Enxl#(t?eqfktP<< zFe{*WHz0%gX7loqL@+$W$<7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rx3Dyz_b)$pd}s+`{v$gQNuCp<>wpYi`l<@G0p4^j&ALF&Vl16E+>!_=u% zA#-qY@*s06bvjiHB&-_;nbVN4F_USDl3{>`a_Ll> zQBu>COD3m*PD4&Qg(ta-8dp7KTv6^%(h8Z(*ITG!kYS%?9EcE{0#j2duqJgL{6%I8 zFjC+|s8ED->J;Rh0(jGatq!>!XP}>$(4e0f8=KIepTIS6LW6rOeb_c;lGb5X%j80z z&!f--(>^u>df<|=8PHR11`Dl2=FWWrYs=SLsA7;|1N4Z{m4tqLT!Vhx>mApiAIEKB zT!Y)2Znb$$(mM2NnOx}ec@%nJ+Tkned7~b<#5)6e%FSS*K|gnH7;DSdTc~1?VFUDt J(C-iZ{{sd=eP{px literal 0 HcmV?d00001 diff --git a/assets/ships/decorator.png b/assets/ships/decorator.png new file mode 100644 index 0000000000000000000000000000000000000000..30267f68eaa83468491380c082aa9135188ae085 GIT binary patch literal 397 zcmV;80doF{P)Nv+`iOi4<3`lMTwQ_)LkWzJ) z$jzZnl{|nNr3nd2ran9)AcE+1q;+>skN2pv8ioNe@f5ZCP5{8+kzgV+4WyV^ltZil z5e<2EMxLDkK-|e91x#_iT>t=iRv9&dl?YbAEuNl^NKZ%b?P8T6qTeL|z!o_H;M{ym2(qG@evUmw6f=+ZpI_UN4FRC-dVGDPi*W$J z%*tJRdq8Uq0BD*95L_-luyK=oBmAu%*aZR>^yKcK4lvE-DTWsisI}cD& z;rjNzso>OxJ_5k}grgRITYW}rt?IfS?afU@YG&U}Hd;?S?v3Ac4@iegDejJ74I7Rq r=q02!ypvdKy?SikMEifke^1~W%9()&qRqW;00000NkvXXu0mjfn%SQH literal 0 HcmV?d00001 diff --git a/assets/ships/excalibur-iv.png b/assets/ships/excalibur-iv.png new file mode 100644 index 0000000000000000000000000000000000000000..8385fa410ee05f3782e69b79e9ff05d21488230e GIT binary patch literal 401 zcmV;C0dD?@P)OQVDk;%^B6FvT@A z2@0aSU?bplK~WUO-+7)tTx2d^bOnM4SU2Asf~?5KpJPuErj&B_<@>i|LjY*n4(07_ zHVy!kQp{d^dw_Ee0I2I4AY3lLFma=N4*pjUYy>QPMJ3QD@}p@xvu@fBeIiK&*4WSs zdmiW$iO=(8Rl%_heFT8%35U)6w)hO^oK;oj>`hHXY+~O|=B!5^_r|Zf2dKj(6?aFl vgcU~=^b%AX-bu_kUpzK%qV2!o(-Zgs1TlUQi55&;00000NkvXXu0mjfl;D}= literal 0 HcmV?d00001 diff --git a/captain/johndanger.lua b/captain/johndanger.lua index bb7cf2a..488b77a 100644 --- a/captain/johndanger.lua +++ b/captain/johndanger.lua @@ -1,7 +1,8 @@ JohnDanger = Object.extend(Player) function JohnDanger:new() + JohnDanger.super.new(self) self.name = "John Danger"; - self.shipName = "The Decorator" self.image = nil + self.ship = Decorator() end diff --git a/captain/player.lua b/captain/player.lua index b7b0535..71f70ce 100644 --- a/captain/player.lua +++ b/captain/player.lua @@ -4,4 +4,15 @@ function Player:new() self.name = ""; self.shipName = "" self.image = nil + self.ship = nil + self.px = 0 + self.py = 0 + self.rot = 0 + self.speed = 5 + self.acc = 0 + self.accIncr = 0.1 end + +function Player:getShipname() + return self.ship.name +end \ No newline at end of file diff --git a/captain/robertdavis.lua b/captain/robertdavis.lua index 98c7316..4b0c2b3 100644 --- a/captain/robertdavis.lua +++ b/captain/robertdavis.lua @@ -1,7 +1,8 @@ RobertDavis = Object.extend(Player) function RobertDavis:new() + RobertDavis.super.new(self) self.name = "Robert Davis"; - self.shipName = "Excalibur IV" self.image = nil + self.ship = ExcaliburIV() end diff --git a/captain/stevelayer.lua b/captain/stevelayer.lua index 4fe8d0a..e0ccc26 100644 --- a/captain/stevelayer.lua +++ b/captain/stevelayer.lua @@ -1,7 +1,8 @@ SteveLayer = Object.extend(Player) function SteveLayer:new() + SteveLayer.super.new(self) self.name = "Steve Layer" - self.shipName = "Blackstar 5" self.image = nil + self.ship = Blackstar5() end diff --git a/main.lua b/main.lua index 6e66955..e3a6ca2 100644 --- a/main.lua +++ b/main.lua @@ -17,6 +17,8 @@ function love.load() Object = require "vendor/classic" + require "vendor/math" + moonshine = require "shaders" effect = moonshine(moonshine.effects.vignette).chain(moonshine.effects.filmgrain) effect.vignette.softness = 0.4 @@ -26,11 +28,17 @@ function love.load() require "scene/load" require "scene/title" require "scene/game" + require "captain/player" require "captain/robertdavis" require "captain/stevelayer" require "captain/johndanger" + require "ship/ship" + require "ship/blackstar5" + require "ship/excaliburiv" + require "ship/decorator" + LoadScene = LoadScene() TitleScene = TitleScene() GameScene = GameScene() diff --git a/scene/game.lua b/scene/game.lua index 3484c1f..84153dd 100644 --- a/scene/game.lua +++ b/scene/game.lua @@ -4,37 +4,129 @@ function GameScene:new() end function GameScene:init() + GameScene:playerChanged(currentPlayer) + movementDelta = 0 end function GameScene:update(dt) - + GameScene:updateInput(dt) + GameScene:updateBounds(dt) end function GameScene:draw() + love.graphics.setColor(255,255,255, 1) + love.graphics.draw( + currentPlayer.ship.image, + currentPlayer.px, + currentPlayer.py, + currentPlayer.rot*(math.pi/180), + 1, 1, + currentPlayer.ship.image:getWidth()/2, + currentPlayer.ship.image:getHeight()/2 + ) + love.graphics.print(currentPlayer.px..","..currentPlayer.py.." s: " .. currentPlayer.speed .. " a: " ..currentPlayer.acc,10,10) end function GameScene:drawHud() - -- Draw images love.graphics.setColor(255,255,255, 1) love.graphics.draw( gameHud, 0, 600-66 ) love.graphics.setColor(255,255,255, 0.75) - love.graphics.draw( currentPlayer.image, 14, 550,0,0.5,0.5 ) + love.graphics.draw( currentPlayer.image, 14, 550, 0, 0.5, 0.5 ) love.graphics.setColor( text.r, text.g, text.b, text.alpha ) love.graphics.print( currentPlayer.name, 48, 550 ) - love.graphics.print( currentPlayer.shipName, 48, 566 ) + love.graphics.print( currentPlayer:getShipname(), 48, 566 ) end function GameScene:keypressed(key,unicode) if key == "1" then - currentPlayer = CaptainSteve + GameScene:playerChanged(CaptainSteve) elseif key == "2" then - currentPlayer = CaptainRobert + GameScene:playerChanged(CaptainRobert) elseif key == "3" then - currentPlayer = CaptainJohn + GameScene:playerChanged(CaptainJohn) end end + +function GameScene:playerChanged(to) + currentPlayer = to + currentPlayer.px = windowWidth/2 + currentPlayer.py = windowHeight/2 + currentPlayer.rot = 0 + currentPlayer.acc = 0 + currentPlayer.bounds = { x1= 20, y1= 20, x2= windowWidth-30, y2= windowHeight - 86} +end + +function GameScene:updateInput(dt) + movementDelta = movementDelta + dt + if (movementDelta > 0.02) then + movementDelta = 0 + + local isUp = false + local isLeft = false + local isDown = false + local isRight = false + local rotation = 0 + + --local hAxis, vAxis, hAxis2, vAxis2 = love.joystick.getAxes(1) + --local axisMargin = 0.5 + + isUp = love.keyboard.isDown( "w" )-- or (not (vAxis == nil) and vAxis < -(1-axisMargin)) or (not (vAxis2 == nil) and vAxis2 < -(1-axisMargin)) or love.joystick.isDown(1, 1) + isDown = love.keyboard.isDown( "s" )-- or (not (vAxis == nil) and vAxis > (1-axisMargin)) or (not (vAxis2 == nil) and vAxis2 > (1-axisMargin)) or love.joystick.isDown(1, 2) + isLeft = love.keyboard.isDown( "a" )-- or (not (hAxis == nil) and hAxis < -(1-axisMargin)) or (not (hAxis2 == nil) and hAxis2 < -(1-axisMargin)) or love.joystick.isDown(1, 3) + isRight = love.keyboard.isDown( "d" )-- or (not (hAxis == nil) and hAxis > (1-axisMargin)) or (not (hAxis2 == nil) and hAxis2 > (1-axisMargin)) or love.joystick.isDown(1, 4) + + if isUp and isLeft then + rotation = 315 + elseif isUp and isRight then + rotation = 45 + elseif isUp then + rotation = 0 + elseif isDown and isLeft then + rotation = 225 + elseif isDown and isRight then + rotation = 135 + elseif isDown then + rotation = 180 + elseif isLeft then + rotation = 270 + elseif isRight then + rotation = 90 + end + + currentPlayer.rot = rotation + + if isUp or isDown or isLeft or isRight then + currentPlayer.acc = currentPlayer.acc + currentPlayer.accIncr + elseif currentPlayer.acc > 0 then + currentPlayer.acc = currentPlayer.acc - currentPlayer.accIncr + end + + currentPlayer.acc = math.clamp(0, currentPlayer.acc, 1) + + if isUp then + currentPlayer.py = currentPlayer.py - (currentPlayer.speed*currentPlayer.acc) + end + + if isDown then + currentPlayer.py = currentPlayer.py + (currentPlayer.speed*currentPlayer.acc) + end + + if isLeft then + currentPlayer.px = currentPlayer.px - (currentPlayer.speed*currentPlayer.acc) + end + + if isRight then + currentPlayer.px = currentPlayer.px + (currentPlayer.speed*currentPlayer.acc) + end + end +end + +function GameScene:updateBounds(dt) + currentPlayer.px = math.clamp( currentPlayer.bounds.x1, currentPlayer.px, currentPlayer.bounds.x2 ) + currentPlayer.py = math.clamp( currentPlayer.bounds.y1, currentPlayer.py, currentPlayer.bounds.y2 ) +end \ No newline at end of file diff --git a/scene/load.lua b/scene/load.lua index 98b5338..e4bbcd6 100644 --- a/scene/load.lua +++ b/scene/load.lua @@ -7,8 +7,8 @@ function LoadScene:update(dt) end function LoadScene:draw() - love.graphics.setColor( text.r, text.g, text.b, text.a ) - love.graphics.print("Loading assets", 10, 10) + --love.graphics.setColor( text.r, text.g, text.b, text.a ) + --love.graphics.print("Loading assets", 10, 10) end function LoadScene:drawHud() diff --git a/scene/title.lua b/scene/title.lua index 860e448..69ab083 100644 --- a/scene/title.lua +++ b/scene/title.lua @@ -43,6 +43,7 @@ function TitleScene:update(dt) if state == "complete" then currentScene = GameScene + currentScene:init() end end diff --git a/ship/blackstar5.lua b/ship/blackstar5.lua new file mode 100644 index 0000000..96d4afd --- /dev/null +++ b/ship/blackstar5.lua @@ -0,0 +1,7 @@ +Blackstar5 = Object.extend(Ship) + +function Blackstar5:new() + Blackstar5.super.new(self) + self.name = "Blackstar 5"; + self.image = nil +end diff --git a/ship/decorator.lua b/ship/decorator.lua new file mode 100644 index 0000000..3b03f6c --- /dev/null +++ b/ship/decorator.lua @@ -0,0 +1,7 @@ +Decorator = Object.extend(Ship) + +function Decorator:new() + Decorator.super.new(self) + self.name = "The Decorator"; + self.image = nil +end diff --git a/ship/excaliburiv.lua b/ship/excaliburiv.lua new file mode 100644 index 0000000..06ed0b3 --- /dev/null +++ b/ship/excaliburiv.lua @@ -0,0 +1,7 @@ +ExcaliburIV = Object.extend(Ship) + +function ExcaliburIV:new() + ExcaliburIV.super.new(self) + self.name = "Excalibur IV"; + self.image = nil +end diff --git a/ship/ship.lua b/ship/ship.lua new file mode 100644 index 0000000..7658c68 --- /dev/null +++ b/ship/ship.lua @@ -0,0 +1,6 @@ +Ship = Object.extend(Object) + +function Ship:new() + self.name = ""; + self.image = nil +end diff --git a/vendor/math.lua b/vendor/math.lua new file mode 100644 index 0000000..ec46adc --- /dev/null +++ b/vendor/math.lua @@ -0,0 +1,64 @@ +-- Averages an arbitrary number of angles (in radians). +function math.averageAngles(...) + local x,y = 0,0 + for i=1,select('#',...) do local a= select(i,...) x, y = x+math.cos(a), y+math.sin(a) end + return math.atan2(y, x) +end + + +-- Returns the distance between two points. +function math.dist(x1,y1, x2,y2) return ((x2-x1)^2+(y2-y1)^2)^0.5 end + + +-- Returns the angle between two points. +function math.angle(x1,y1, x2,y2) return math.atan2(x2-x1, y2-y1) end + + +-- Returns the closest multiple of 'size' (defaulting to 10). +function math.multiple(n, size) size = size or 10 return math.round(n/size)*size end + + +-- Clamps a number to within a certain range. +function math.clamp(low, n, high) return math.min(math.max(low, n), high) end + + +-- Linear interpolation between two numbers. +function lerp(a,b,t) return a+(b-a)*t end + +-- Cosine interpolation between two numbers. +function cerp(a,b,t) local f=(1-math.cos(t*math.pi))*.5 return a*(1-f)+b*f end + + +-- Normalize two numbers. +function math.normalize(x,y) local l=(x*x+y*y)^.5 if l==0 then return 0,0,0 else return x/l,y/l,l end end + + +-- Returns 'n' rounded to the nearest 'deci'th (defaulting whole numbers). +function math.round(n, deci) deci = 10^(deci or 0) return math.floor(n*deci+.5)/deci end + + +-- Randomly returns either -1 or 1. +function math.rsign() return math.random(2) == 2 and 1 or -1 end + + +-- Returns 1 if number is positive, -1 if it's negative, or 0 if it's 0. +function math.sign(n) return n>0 and 1 or n<0 and -1 or 0 end + + +-- Checks if two lines intersect (or line segments if seg is true) +-- Lines are given as four numbers (two coordinates) +function findIntersect(l1p1x,l1p1y, l1p2x,l1p2y, l2p1x,l2p1y, l2p2x,l2p2y, seg1, seg2) + local a1,b1,a2,b2 = l1p2y-l1p1y, l1p1x-l1p2x, l2p2y-l2p1y, l2p1x-l2p2x + local c1,c2 = a1*l1p1x+b1*l1p1y, a2*l2p1x+b2*l2p1y + local det,x,y = a1*b2 - a2*b1 + if det==0 then return false, "The lines are parallel." end + x,y = (b2*c1-b1*c2)/det, (a1*c2-a2*c1)/det + if seg1 or seg2 then + local min,max = math.min, math.max + if seg1 and not (min(l1p1x,l1p2x) <= x and x <= max(l1p1x,l1p2x) and min(l1p1y,l1p2y) <= y and y <= max(l1p1y,l1p2y)) or + seg2 and not (min(l2p1x,l2p2x) <= x and x <= max(l2p1x,l2p2x) and min(l2p1y,l2p2y) <= y and y <= max(l2p1y,l2p2y)) then + return false, "The lines don't intersect." + end + end + return x,y +end \ No newline at end of file