This commit is contained in:
PossiblyAxolotl 2022-08-13 18:49:06 -06:00
parent 2bf54bc7f6
commit f453f269b0
6 changed files with 54 additions and 19 deletions

View file

@ -236,6 +236,9 @@ function beginEndCutscene()
song:play(0) song:play(0)
createStars() createStars()
createMenu(mainmenu) createMenu(mainmenu)
imgBigRocket:hide()
end) end)
song:play() song:play()

View file

@ -225,11 +225,28 @@ function editUpdate()
positionLerp.x = playdate.math.lerp(positionLerp.x, position.x * 16, 0.5) positionLerp.x = playdate.math.lerp(positionLerp.x, position.x * 16, 0.5)
positionLerp.y = playdate.math.lerp(positionLerp.y, position.y * 16, 0.5) positionLerp.y = playdate.math.lerp(positionLerp.y, position.y * 16, 0.5)
if playdate.buttonIsPressed(playdate.kButtonA) then
if editor == "tiles" then
tilemapEditor:setTileAtPosition(position.x+12,position.y+8,math.floor( tileIndex ) + 1)
for tile = 1, #tiles, 1 do
if tiles[tile].x == position.x + 12 and tiles[tile].y == position.y+8 then
table.remove(tiles,tile)
break
end
end
tiles[#tiles+1] = {x=position.x + 12, y=position.y + 8, t=math.floor( tileIndex ) + 1}
imgtiles = gfx.sprite.new(tilemapEditor)
end
end
if playdate.buttonJustPressed(playdate.kButtonA) then if playdate.buttonJustPressed(playdate.kButtonA) then
if editor == "pos2Saw" then if editor == "pos2Saw" then
sawblades[#sawblades+1] = {start={x=pos1.x,y=pos1.y},ends = {x=(position.x + 11) * 16,y=(position.y + 7) * 16}, speed = traveltime} sawblades[#sawblades+1] = {start={x=pos1.x,y=pos1.y},ends = {x=(position.x + 11) * 16,y=(position.y + 7) * 16}, speed = traveltime}
editor = "main" editor = "main"
tileIndex = 2 tileIndex = 2
elseif editor == "tiles" and math.floor( tileIndex ) == 0 then
editor = "main"
elseif editor == "music" then elseif editor == "music" then
selSong = editorSongs[math.floor(tileIndex) + 1] selSong = editorSongs[math.floor(tileIndex) + 1]
editor = "main" editor = "main"
@ -243,14 +260,6 @@ function editUpdate()
editor = "main" editor = "main"
tileIndex = 3 tileIndex = 3
printTable(spins[#spins]) printTable(spins[#spins])
elseif editor == "tiles" then
if math.floor( tileIndex ) == 0 then
editor = "main"
else
tilemapEditor:setTileAtPosition(position.x+12,position.y+8,math.floor( tileIndex ) + 1)
tiles[#tiles+1] = {x=position.x + 12, y=position.y + 8, t=math.floor( tileIndex ) + 1}
imgtiles = gfx.sprite.new(tilemapEditor)
end
elseif editor == "main" then elseif editor == "main" then
if math.floor( tileIndex ) == 0 then if math.floor( tileIndex ) == 0 then
--[[ --[[
@ -283,6 +292,10 @@ function editUpdate()
end end
end end
if playdate.isCrankDocked() then
editor = "main"
end
if playdate.buttonJustPressed(playdate.kButtonB) then if playdate.buttonJustPressed(playdate.kButtonB) then
if editor == "tiles" then if editor == "tiles" then
tilemapEditor:setTileAtPosition(position.x+12,position.y+8,0) tilemapEditor:setTileAtPosition(position.x+12,position.y+8,0)
@ -344,27 +357,27 @@ function editUpdate()
end end
if editor ~= "settings" then if editor ~= "settings" then
if playdate.buttonIsPressed(playdate.kButtonLeft) and positionLerp.x/16 < position.x +0.05 then if playdate.buttonIsPressed(playdate.kButtonLeft) and positionLerp.x/16 < position.x +0.03 then
if editor ~= "pos2Spin" then if editor ~= "pos2Spin" then
position.x -= 1 position.x -= 1
else else
armamount-=1 armamount-=1
if armamount < 1 then armamount = 1 end if armamount < 1 then armamount = 1 end
end end
elseif playdate.buttonIsPressed(playdate.kButtonRight) and positionLerp.x/16 > position.x -0.05 then elseif playdate.buttonIsPressed(playdate.kButtonRight) and positionLerp.x/16 > position.x -0.03 then
if editor ~= "pos2Spin" then if editor ~= "pos2Spin" then
position.x += 1 position.x += 1
else else
armamount+=1 armamount+=1
end end
end end
if playdate.buttonIsPressed(playdate.kButtonUp) and positionLerp.y/16 < position.y+0.05 then if playdate.buttonIsPressed(playdate.kButtonUp) and positionLerp.y/16 < position.y+0.03 then
if editor ~= "pos2Spin" then if editor ~= "pos2Spin" then
position.y -= 1 position.y -= 1
else else
armlength += 1 armlength += 1
end end
elseif playdate.buttonIsPressed(playdate.kButtonDown) and positionLerp.y/16 > position.y -0.05 then elseif playdate.buttonIsPressed(playdate.kButtonDown) and positionLerp.y/16 > position.y -0.03 then
if editor ~= "pos2Spin" then if editor ~= "pos2Spin" then
position.y += 1 position.y += 1
else else
@ -473,7 +486,16 @@ end
if editor == "tiles" then if editor == "tiles" then
gfx.drawText("A TO PLACE \nB TO DELETE",0,0) gfx.drawText("A TO PLACE \nB TO DELETE",0,0)
local ind = math.floor( tileIndex / 8 ) * 8 local ind = math.floor( tileIndex / 8 ) * 8
if tileIndex < 8 then imgExitMen:draw(366,8) else tileTable[1+ind]:draw(373,13) end if tileIndex < 8 then
gfx.setColor(gfx.kColorXOR)
imgExitMen:draw(366,8)
gfx.fillRect(391,41,2,2)
gfx.fillRect(391,69,2,2)
gfx.fillRect(391,97,2,2)
gfx.fillRect(391,125,2,2)
else
tileTable[1+ind]:draw(373,13)
end
tileTable[2+ind]:draw(373,41) tileTable[2+ind]:draw(373,41)
tileTable[3+ind]:draw(373,69) tileTable[3+ind]:draw(373,69)
tileTable[4+ind]:draw(373,97) tileTable[4+ind]:draw(373,97)
@ -564,5 +586,7 @@ end
local gravs = {[0.2]="REGULAR",[0]="NONE",[-0.2]="NEGATIVE"} local gravs = {[0.2]="REGULAR",[0]="NONE",[-0.2]="NEGATIVE"}
function getGrav() function getGrav()
if gravs[grav] then
return gravs[grav] return gravs[grav]
else return grav end
end end

View file

@ -20,10 +20,13 @@ sprRocket:setGroups({1,2,3})
local imgBigRocket = gfx.image.new("gfx/bigrocket") local imgBigRocket = gfx.image.new("gfx/bigrocket")
local imgBigFire = gfx.imagetable.new("gfx/bigrocketfire") local imgBigFire = gfx.imagetable.new("gfx/bigrocketfire")
local imgSpawn = gfx.image.new("gfx/spawn")
assert(imgBigRocket) assert(imgBigRocket)
assert(imgBigFire) assert(imgBigFire)
assert(imgSpawn)
local loopBigFire = gfx.animation.loop.new(200,imgBigFire) local loopBigFire = gfx.animation.loop.new(200,imgBigFire)
local sprBigRocket = gfx.sprite.new(imgBigRocket) local sprBigRocket = gfx.sprite.new(imgBigRocket)
local sprSpawn = gfx.sprite.new(imgSpawn)
sprBigRocket:setCollideRect(0,0,64,64) sprBigRocket:setCollideRect(0,0,64,64)
sprBigRocket:setGroups({2}) sprBigRocket:setGroups({2})
sprBigRocket:setCollidesWithGroups({2}) sprBigRocket:setCollidesWithGroups({2})
@ -34,6 +37,8 @@ local sfxDie = playdate.sound.sampleplayer.new("sfx/die")
function setSpawn(_x,_y) function setSpawn(_x,_y)
startpos = {x=_x,y=_y} startpos = {x=_x,y=_y}
miniExplode(sprSpawn.x,sprSpawn.y)
sprSpawn:moveTo(_x,_y)
end end
local function die() local function die()
@ -51,6 +56,9 @@ function addPlayer(_x,_y,__x,__y)
dead = false dead = false
scale = 1 scale = 1
active = false active = false
sprSpawn:add()
sprSpawn:moveTo(_x,_y)
velocity = {x=0,y=0} velocity = {x=0,y=0}
startpos = {x= _x,y=_y} startpos = {x= _x,y=_y}
sprBigRocket:moveTo(__x,__y) sprBigRocket:moveTo(__x,__y)
@ -129,7 +137,7 @@ local function playerWin()
exists = false exists = false
dead = true dead = true
if playdate.buttonIsPressed(playdate.kButtonA) then if playdate.buttonJustPressed(playdate.kButtonA) then
song:stop() song:stop()
song:setFinishCallback(nil) song:setFinishCallback(nil)
if next then if next then
@ -191,7 +199,7 @@ function updatePlayer()
end end
elseif exists == true then elseif exists == true then
if inp and playdate.isCrankDocked() == false then if (playdate.buttonJustPressed(playdate.kButtonUp) or playdate.buttonJustPressed(playdate.kButtonDown) or playdate.buttonJustPressed(playdate.kButtonLeft) or playdate.buttonJustPressed(playdate.kButtonRight) or playdate.buttonJustPressed(playdate.kButtonA) or playdate.buttonJustPressed(playdate.kButtonB)) and playdate.isCrankDocked() == false then
active = true active = true
end end
local cx, cy = gfx.getDrawOffset() local cx, cy = gfx.getDrawOffset()

View file

@ -123,7 +123,7 @@ function loadChecks(_checks)
checks[i]:setGroups({2}) checks[i]:setGroups({2})
checks[i]:setCollidesWithGroups({3}) checks[i]:setCollidesWithGroups({3})
checks[i]:setZIndex(3) checks[i]:setZIndex(3)
checks[i]:setCollideRect(-6,-6 ,30,30) checks[i]:setCollideRect(-3,-3 ,38,38)
checks[i]:add() checks[i]:add()
end end
end end

BIN
Source/gfx/spawn.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 132 B

View file

@ -3,6 +3,6 @@ author=PossiblyAxolotl
description=Help a crew of rockets collect energy to get back home! description=Help a crew of rockets collect energy to get back home!
bundleID=com.PossiblyAxolotl.RocketBytes bundleID=com.PossiblyAxolotl.RocketBytes
launchSoundPath=launcher/rocketing launchSoundPath=launcher/rocketing
version=1.2.1 version=1.3.0
buildNumber=10201 buildNumber=10300
imagePath=launcher imagePath=launcher