local gfx = playdate.graphics local imgBigRocket = gfx.image.new("gfx/bigrocket") local tabBigRocket = gfx.imagetable.new("gfx/bigrocketfire") local tabSmallRocket = gfx.imagetable.new("gfx/fire") local imgMother = gfx.image.new("gfx/starscraper") assert(imgBigRocket) assert(tabBigRocket) assert(tabSmallRocket) assert(imgMother) local shake = 0 local animBigRocket = gfx.animation.loop.new(200,tabBigRocket) local animRocket = gfx.animation.loop.new(200,tabSmallRocket) local sprCutsceneBigRocket = gfx.sprite.new(tabBigRocket[1]) sprCutsceneBigRocket:setRotation(90) -- cutscene 1 local gotoGame = false local showFuelMeter = false local transfer = true local fuelshowncount = -1 local scene1Blip = playdate.sound.sampleplayer.new("sfx/cutsceneblip") scene1Blip:setVolume(0.7) local scene1Explosion = playdate.sound.sampleplayer.new("sfx/cutsceneexplosion") local fuelTimer function beginStartCutscene(_gotoGame) mode = "startCutscene" fuelshowncount = -1 gotoGame = _gotoGame --sprCutsceneBigRocket:moveTo(51,120) sprCutsceneBigRocket:moveTo(-sprCutsceneBigRocket.height,120) transfer = true sprCutsceneBigRocket:setScale(1.5) sprCutsceneBigRocket:add() playdate.timer.new(1000, function() local brAnimator = gfx.animator.new(4000, playdate.geometry.point.new(-sprCutsceneBigRocket.height,120),playdate.geometry.point.new(200,120), playdate.easingFunctions.outQuad) sprCutsceneBigRocket:setAnimator(brAnimator) end ) createStars(-10) end function updateStartCutscene() playdate.timer.updateTimers() gfx.clear() gfx.setDrawOffset(math.random(-3,3)*shake,math.random(-3,3)*shake) sprCutsceneBigRocket:setImage(animBigRocket:image()) gfx.sprite.update() processStars(-10,-10) processExplosions() if fuelshowncount == -1 and sprCutsceneBigRocket.x == 200 then fuelshowncount = 0 fuelTimer = playdate.timer.new(500, function () fuelshowncount+=1 showFuelMeter = not showFuelMeter if showFuelMeter then scene1Blip:play() end end) fuelTimer.repeats = true fuelTimer:reset() fuelTimer:start() end if fuelshowncount == 5 then -- when the fuel blinking is done fuelTimer.repeats = false fuelshowncount = 6 local dietimer = playdate.timer.new(1000, function () explode(200,120) shake = 3 showFuelMeter =false song:stop() scene1Explosion:play() local falltimer = playdate.timer.new(700, function () local a = gfx.animator.new(3000, playdate.geometry.point.new(200,120),playdate.geometry.point.new(200,240+sprCutsceneBigRocket.width),playdate.easingFunctions.inBack) sprCutsceneBigRocket:setAnimator(a) end) end) end if sprCutsceneBigRocket.y == 240+sprCutsceneBigRocket.width and transfer then transfer = false local gametimer = playdate.timer.new(1000,function () if gotoGame then map = "data/1. HOOK.json" addMapSave("data/1. HOOK.json") else createMenu(mainmenu) song:play(0) end applyStarSpeed(10,0) end) end if showFuelMeter then gfx.setLineWidth(2) gfx.setColor(gfx.kColorWhite) gfx.drawRect(194,35,70,10) gfx.drawText("FUEL",131,32) end if shake > 0 then shake -= .1 elseif shake < 0 then shake = 0 end end -- end custscene local imgEndPlatform = gfx.image.new("gfx/endplatform") assert(imgEndPlatform) local scene = 1 local platformY = -imgEndPlatform.height local endRocketY = 0 local mompos = -100 local rockParts = {} local function processRockParts() for part = 1, #rockParts, 1 do if rockParts[part] ~= nil then rockParts[part].y-= 24 animRocket:image():draw(rockParts[part].x,rockParts[part].y) if rockParts[part].y < -46 then rockParts[part] = nil end end end end local smY = {260,260,260} local smYl = {80,80,120} local rocketadd = playdate.timer.new(400) rocketadd.discardOnCompletion = false local partsadd = false -- rockParts[#rockParts+1] = {y=265,x=math.random(50,350-(animRocket:image().width*1.5))} function beginEndCutscene() mode = "endCutscene" rockParts = {} partsadd = false scene = 1 endRocketY = 0 smY = {260,260,260} smYl = {80,80,120} platformY = -imgEndPlatform.height mompos = -100 rocketadd = playdate.timer.new(400) rocketadd.discardOnCompletion = false local partsadd = false song:stop() song:load("sfx/song4") playdate.timer.new(1000, function () playdate.timer.new(3200, function () scene = 2 end) playdate.timer.new(9600, function () shake = 5 scene = 3 applyStarSpeed(0,5) end) playdate.timer.new(16000, function () applyStarSpeed(0,5) scene = 4 shake = 3 explode(200,150) end) playdate.timer.new(17600, function () scene = 5 end) playdate.timer.new(20800, function () smYl[1] = -120 end) playdate.timer.new(21200, function () smYl[2] = -120 end) playdate.timer.new(21600, function () smYl[3] = -120 end) playdate.timer.new(22000, function () scene = 6 end) playdate.timer.new(22400, function () scene = 7 endRocketY = 300 createStars(0,12) end) playdate.timer.new(28800, function () partsadd = true end) playdate.timer.new(35200, function () scene = 8 createStars(12,12) end) playdate.timer.new(38400, function () scene = 9 createStars(8,8,3) end) playdate.timer.new(41600, function () scene = 10 createStars(4,4,2) end) playdate.timer.new(44800, function () scene = 11 end) playdate.timer.new(60000, function () song:stop() song:load("sfx/song1") song:play(0) createStars() createMenu(mainmenu) end) song:play() end) end function processEndCutscene() playdate.timer.updateTimers() gfx.clear() gfx.setDrawOffset(math.random(-3,3)*shake,math.random(-3,3)*shake) processStars(-10,-10) if scene == 2 then platformY = playdate.math.lerp(platformY,130,0.1) endRocketY = platformY-imgBigRocket.height*1.5 imgBigRocket:drawScaled(200-imgBigRocket.width*0.75,endRocketY,1.5) imgEndPlatform:draw(0,platformY) elseif scene == 3 then animBigRocket:image():drawScaled(200-imgBigRocket.width*0.75,endRocketY,1.5) endRocketY = playdate.math.lerp(endRocketY, 120 - (imgBigRocket.width *0.75),0.1) if platformY ~= 280 then platformY = playdate.math.lerp(platformY,280,0.05) imgEndPlatform:draw(0,platformY) end elseif scene == 4 then animBigRocket:image():drawScaled(200-imgBigRocket.width*0.75,120-imgBigRocket.height*0.75,1.5) smY[1] = playdate.math.lerp(smY[1],smYl[1],0.1) smY[2] = playdate.math.lerp(smY[2],smYl[2],0.1) animRocket:image():drawScaled(20,smY[1],1.5) animRocket:image():drawScaled(380-(animRocket:image().width*1.5),smY[2],1.5) elseif scene == 5 then animBigRocket:image():drawScaled(200-imgBigRocket.width*0.75,endRocketY,1.5) animRocket:image():drawScaled(20,smY[1],1.5) animRocket:image():drawScaled(380-(animRocket:image().width*1.5),smY[2],1.5) smY[1] = playdate.math.lerp(smY[1],smYl[1],0.1) smY[2] = playdate.math.lerp(smY[2],smYl[2],0.1) smY[3] = playdate.math.lerp(smY[3],smYl[3],0.1) animRocket:image():drawScaled(70,smY[3],1.5) animRocket:image():drawScaled(330-(animRocket:image().width*1.5),smY[3],1.5) elseif scene == 6 then smY[1] = playdate.math.lerp(smY[1],smYl[1],0.1) smY[2] = playdate.math.lerp(smY[2],smYl[2],0.1) smY[3] = playdate.math.lerp(smY[3],smYl[3],0.1) endRocketY = playdate.math.lerp(endRocketY, -300, 0.1) animBigRocket:image():drawScaled(200-imgBigRocket.width*0.75,endRocketY,1.5) elseif scene == 7 then endRocketY = playdate.math.lerp(endRocketY, 120 - (imgBigRocket.width *0.75),0.1) animBigRocket:image():drawScaled(200-imgBigRocket.width*0.75,endRocketY,1.5) if rocketadd.timeLeft <= 0 then rockParts[#rockParts+1] = {y=265,x=math.random(20,380-(animRocket:image().width*1.5))} if partsadd then rockParts[#rockParts+1] = {y=265,x=math.random(20,380-(animRocket:image().width*1.5))} end rocketadd:reset() end elseif scene == 8 then animBigRocket:image():drawRotated(300,160,315,1.5) elseif scene == 9 then animBigRocket:image():drawRotated(300,160,315,1) elseif scene == 10 then animBigRocket:image():drawRotated(300,160,315,0.2) elseif scene == 11 then mompos = playdate.math.lerp(mompos,70,0.01) imgMother:drawRotated(mompos,110,26.6) animBigRocket:image():drawRotated(300,160,315,0.2) --gfx.drawText("THANKS FOR PLAYING",200-gfx.getTextSize("THANKS FOR PLAYING")/2,220) end if shake > 0 then shake -= .1 elseif shake < 0 then shake = 0 end processRockParts() processExplosions() end