Skip to content
Snippets Groups Projects
Commit 6788a782 authored by Adam Procter's avatar Adam Procter
Browse files

more tests to get thrust pinned to the tail

parent 6f1923cc
No related branches found
No related tags found
No related merge requests found
No preview for this file type
......@@ -5,4 +5,4 @@ bundleID=uk.co.adamprocter.playthrust
version=0.0.1
imagePath=images
pdxversion=11200
buildtime=726016473
buildtime=726086797
......@@ -20,6 +20,10 @@ local shipDy = 0
local thrustShip = nil
local gravity = 1.5
-- for thrust
newShipX = nil
newShipY = nil
-- viewport
-- 400 x 240 screen
local xOffsetmin = 100
......@@ -51,6 +55,7 @@ function myGameSetUp()
playerShip:setCollideRect(0,0,32,32)
playerShip:add()
-- set up thrust
thrustShip = gfx.sprite.new()
assert(thrustShip)
......@@ -114,6 +119,7 @@ function playerShip:update()
gfx.setColor(gfx.kColorBlack)
gfx.drawPolygon(playerShip.polygon)
gfx.popContext()
playerShip:setImage(img)
......@@ -149,28 +155,26 @@ function playerShip:update()
if (spY > yOffsetmax and shipDy >= 0) then
shipMoveDy = 0
end
-- if (spX > xOffsetmin and spX < xOffsetmax and spY > yOffsetmin and spY < yOffsetmax) then
-- if ()
-- end
newShipX = shipMoveDx +spX
newShipY = shipMoveDy +spY
playerShip:moveWithCollisions(shipMoveDx +spX, shipMoveDy +spY)
end
function thrustShip:update()
local spX, spY = playerShip:getPosition()
local img = gfx.image.new(32, 32)
local angle = playdate.getCrankPosition()
gfx.pushContext(img)
gfx.setColor(gfx.kColorWhite)
gfx.fillPolygon(thrustShip.polygon)
gfx.setColor(gfx.kColorBlack)
gfx.drawPolygon(thrustShip.polygon)
gfx.popContext()
thrustShip:setImage(img)
thrustShip:moveTo(spX+8,spY+36)
thrustShip:setZIndex(60)
-- thrustShip:moveTo(spX+8,spY+36)
local angle = playdate.getCrankPosition()
thrustShip:moveTo(newShipX + (32 * math.sin(math.rad(angle))),newShipY+36) thrustShip:setZIndex(60)
thrustShip.thrust_transform:rotate(playdate.getCrankChange(), 16,-16)
thrustShip.thrust_transform:transformPolygon(thrustShip.polygon)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment