This commit is contained in:
PossiblyAxolotl 2022-08-09 13:51:07 -06:00
parent 9ccf995c64
commit b2c881a139
9 changed files with 78 additions and 11 deletions

View file

@ -30,7 +30,7 @@ local grav = 0.2
local imgFloppy = gfx.imagetable.new("gfx/floppyT") local imgFloppy = gfx.imagetable.new("gfx/floppyT")
local imgAdd = gfx.image.new("gfx/add") local imgAdd = gfx.image.new("gfx/add")
local imgMus = gfx.image.new("gfx/music") local imgMus = gfx.image.new("gfx/checkpEditor")
local imgLine = gfx.image.new("gfx/line") local imgLine = gfx.image.new("gfx/line")
local imgSpin = gfx.image.new("gfx/spin") local imgSpin = gfx.image.new("gfx/spin")
local imgCursor = gfx.image.new("gfx/cursor2") local imgCursor = gfx.image.new("gfx/cursor2")
@ -72,6 +72,7 @@ local position = {x=100,y=100}
local positionLerp = {x=0,y=0} local positionLerp = {x=0,y=0}
local powers = {} local powers = {}
local checks = {}
function newProject() function newProject()
mode = "newproj" mode = "newproj"
@ -101,6 +102,7 @@ function editLoadName(name)
playerPos = {x = data.rocket.x, y = data.rocket.y} playerPos = {x = data.rocket.x, y = data.rocket.y}
exitPos = {x = data.bigrocket.x, y = data.bigrocket.y} exitPos = {x = data.bigrocket.x, y = data.bigrocket.y}
position = {x = (data.rocket.x + 6) / 16, y = (data.rocket.y + 4)/16} position = {x = (data.rocket.x + 6) / 16, y = (data.rocket.y + 4)/16}
if data.checks then checks = data.checks end
levelname = name:match("(.+)%..+$") levelname = name:match("(.+)%..+$")
playdate.display.setInverted(data.inverted) playdate.display.setInverted(data.inverted)
grav = data.grav or 0.2 grav = data.grav or 0.2
@ -112,7 +114,7 @@ function editLoadName(name)
tiles[tile] = {x=data.tiles[tile].x,y=data.tiles[tile].y,t=data.tiles[tile].t} tiles[tile] = {x=data.tiles[tile].x,y=data.tiles[tile].y,t=data.tiles[tile].t}
end end
altClrButton = playdate.getSystemMenu():addMenuItem("level settings", function() altClrButton = playdate.getSystemMenu():addMenuItem("level settings", function()
local m = {"NO GRAVITY","NEGATIVE GRAVITY","REGULAR GRAVITY","INVERT COLOURS","RESUME"} local m = {"NO GRAVITY","NEGATIVE GRAVITY","REGULAR GRAVITY","INVERT COLOURS","CHANGE MUSIC","RESUME"}
createMenu(m, true) createMenu(m, true)
end) end)
toolTipButton = playdate.getSystemMenu():addMenuItem("save", function() toolTipButton = playdate.getSystemMenu():addMenuItem("save", function()
@ -137,8 +139,8 @@ function playdate.keyboard.keyboardWillHideCallback(ok)
saveTime = 0 saveTime = 0
grav=0.2 grav=0.2
song:stop() song:stop()
playdate.getSystemMenu():addCheckmarkMenuItem("level settings", function() playdate.getSystemMenu():addMenuItem("level settings", function()
local m = {"NO GRAVITY","NEGATIVE GRAVITY","REGULAR GRAVITY","INVERT LEVEL COLOURS","RESUME"} local m = {"NO GRAVITY","NEGATIVE GRAVITY","REGULAR GRAVITY","INVERT COLOURS","CHANGE MUSIC","RESUME"}
createMenu(m, true) createMenu(m, true)
end) end)
playdate.getSystemMenu():addMenuItem("save",false, function() playdate.getSystemMenu():addMenuItem("save",false, function()
@ -173,7 +175,7 @@ local curYlerp = -32
function editSave() function editSave()
playdate.datastore.delete("levels/"..levelname..".json") playdate.datastore.delete("levels/"..levelname..".json")
saveTime = 5 saveTime = 5
playdate.datastore.write({song=selSong, grav=grav, tiles = tiles, inverted = playdate.display.getInverted(), rocket=playerPos, bigrocket=exitPos, fuel = powers,saws=sawblades,rotators=spins},"levels/"..levelname) playdate.datastore.write({song=selSong, grav=grav, tiles = tiles, inverted = playdate.display.getInverted(), checks=checks, rocket=playerPos, bigrocket=exitPos, fuel = powers,saws=sawblades,rotators=spins},"levels/"..levelname)
end end
local traveltime = 1 local traveltime = 1
@ -235,7 +237,6 @@ function editUpdate()
song:stop() song:stop()
song:load("sfx/song1") song:load("sfx/song1")
end end
tileIndex = 6
songIndexSel = #editorSongs + 1 songIndexSel = #editorSongs + 1
elseif editor == "pos2Spin" then elseif editor == "pos2Spin" then
spins[#spins+1] = {middle=true,x=pos1.x,y=pos1.y,speed=traveltime,arms=armamount,armlen=armlength} spins[#spins+1] = {middle=true,x=pos1.x,y=pos1.y,speed=traveltime,arms=armamount,armlen=armlength}
@ -275,7 +276,7 @@ function editUpdate()
elseif math.floor(tileIndex) == 5 then elseif math.floor(tileIndex) == 5 then
exitPos = {x = (position.x + 11) * 16, y = (position.y + 7) * 16} exitPos = {x = (position.x + 11) * 16, y = (position.y + 7) * 16}
elseif math.floor(tileIndex) == 6 then elseif math.floor(tileIndex) == 6 then
editor = "music" checks[#checks+1] = {x = ((position.x + 11) * 16) - 7, y = ((position.y + 7) * 16) - 5}
elseif math.floor(tileIndex) == 7 then elseif math.floor(tileIndex) == 7 then
editor = "view" editor = "view"
end end
@ -328,6 +329,13 @@ function editUpdate()
break break
end end
end end
elseif math.floor( tileIndex ) == 6 then
for check = 1, #checks, 1 do
if checks[check].x == (position.x + 11) * 16-7 and checks[check].y == (position.y + 7) * 16-5 then
table.remove(checks, check)
break
end
end
end end
elseif editor == "view" then elseif editor == "view" then
editor = "main" editor = "main"
@ -429,6 +437,10 @@ end
imgSquare:draw(powers[power].x,powers[power].y) imgSquare:draw(powers[power].x,powers[power].y)
end end
for check = 1, #checks, 1 do
imgMus:draw(checks[check].x,checks[check].y)
end
if editor ~= "view" then if editor ~= "view" then
imgGrid:drawTiled((position.x-2)*16,(position.y-2)*16,416,288) imgGrid:drawTiled((position.x-2)*16,(position.y-2)*16,416,288)
imgCursor:draw((position.x + 11) * 16, (position.y + 7) * 16) imgCursor:draw((position.x + 11) * 16, (position.y + 7) * 16)
@ -502,7 +514,7 @@ end
elseif math.floor( tileIndex ) == 5 then elseif math.floor( tileIndex ) == 5 then
gfx.drawText("EXIT",0,0) gfx.drawText("EXIT",0,0)
elseif math.floor( tileIndex ) == 6 then elseif math.floor( tileIndex ) == 6 then
gfx.drawText("MUSIC",0,0) gfx.drawText("CHECKPOINTS",0,0)
elseif math.floor( tileIndex ) == 7 then elseif math.floor( tileIndex ) == 7 then
gfx.drawText("VIEW",0,0) gfx.drawText("VIEW",0,0)
end end
@ -530,6 +542,7 @@ function editClose()
powers = {} powers = {}
sawblades = {} sawblades = {}
spins = {} spins = {}
checks = {}
editor = "main" editor = "main"
tileIndex = 0 tileIndex = 0
playdate.display.setInverted(false) playdate.display.setInverted(false)
@ -544,6 +557,10 @@ function setGrav(val)
grav = val grav = val
end end
function setEditor(val)
editor = val
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()

View file

@ -48,6 +48,7 @@ function addMap(_file, rs)
if level.inverted then playdate.display.setInverted(true) else playdate.display.setInverted(false) end if level.inverted then playdate.display.setInverted(true) else playdate.display.setInverted(false) end
if level.saws then loadBlades(level.saws) end if level.saws then loadBlades(level.saws) end
if level.rotators then loadSpins(level.rotators) end if level.rotators then loadSpins(level.rotators) end
if level.checks then loadChecks(level.checks) end
if level.fuel then loadFuel(level.fuel) end if level.fuel then loadFuel(level.fuel) end
grav = level.grav or 0.2 grav = level.grav or 0.2
if level.next then next = level.next end if level.next then next = level.next end

View file

@ -237,6 +237,10 @@ function menuButtonPress(name, index)
barpos = 160 barpos = 160
logopos = -112 logopos = -112
elseif name == "CHANGE MUSIC" then
setEditor("music")
mode = "editor"
elseif name == "START CUTSCENE" then elseif name == "START CUTSCENE" then
local m = {"BACK","WATCH START CUTSCENE"} local m = {"BACK","WATCH START CUTSCENE"}
m[0] = "dat" m[0] = "dat"
@ -312,7 +316,9 @@ function menuButtonPress(name, index)
elseif menu == "qrs" or menu == "data" or menu == "dat" then elseif menu == "qrs" or menu == "data" or menu == "dat" then
local m = {} local m = {}
m[0],m[1], m[2], m[3], m[4], m[5], m[6] = "extras", "BACK","LINKS","END CUTSCENE", "START CUTSCENE", "MUSIC BOX", "LEVEL SELECT" m[0],m[1], m[2], m[3], m[4], m[5], m[6] = "extras", "BACK","LINKS","END CUTSCENE", "START CUTSCENE", "MUSIC BOX", "LEVEL SELECT"
createMenu(m) createMenu(m)
elseif menu == nil then
else else
createMenu(mainmenu) createMenu(mainmenu)
end end

View file

@ -32,6 +32,10 @@ local resetButton = nil
local sfxDie = playdate.sound.sampleplayer.new("sfx/die") local sfxDie = playdate.sound.sampleplayer.new("sfx/die")
function setSpawn(_x,_y)
startpos = {x=_x,y=_y}
end
local function die() local function die()
deaths +=1 deaths +=1
explode(sprRocket.x,sprRocket.y) explode(sprRocket.x,sprRocket.y)

View file

@ -3,15 +3,20 @@ local gfx <const> = playdate.graphics
local imgSaw = gfx.imagetable.new("gfx/sawblades") local imgSaw = gfx.imagetable.new("gfx/sawblades")
local imgFuel = gfx.imagetable.new("gfx/fuel") local imgFuel = gfx.imagetable.new("gfx/fuel")
local imgTarget = gfx.image.new("gfx/target") local imgTarget = gfx.image.new("gfx/target")
local imgCheck = gfx.imagetable.new("gfx/checkpoint")
assert(imgSaw) assert(imgSaw)
assert(imgFuel)
assert(imgTarget) assert(imgTarget)
assert(imgCheck)
local loopSaws = gfx.animation.loop.new(200, imgSaw) local loopSaws = gfx.animation.loop.new(200, imgSaw)
local loopFuel = gfx.animation.loop.new(400, imgFuel) local loopFuel = gfx.animation.loop.new(400, imgFuel)
local loopCheck = gfx.animation.loop.new(300, imgCheck)
local blades = {} local blades = {}
local spinblades = {} local spinblades = {}
local fuels = {} local fuels = {}
local checks = {}
local sfxCollect = playdate.sound.sampleplayer.new("sfx/collect") local sfxCollect = playdate.sound.sampleplayer.new("sfx/collect")
@ -108,6 +113,21 @@ function loadFuel(_fuel)
end end
end end
function loadChecks(_checks)
for i = 1, #_checks, 1 do
local check = _checks[i]
checks[i] = gfx.sprite.new()
checks[i].set = false
checks[i]:moveTo(check.x+16,check.y+16)
checks[i]:setGroups({2})
checks[i]:setCollidesWithGroups({3})
checks[i]:setZIndex(3)
checks[i]:setCollideRect(-6,-6 ,30,30)
checks[i]:add()
end
end
function updateSaws() function updateSaws()
local ox, oy = gfx.getDrawOffset() local ox, oy = gfx.getDrawOffset()
for fuel = 1, #fuels, 1 do for fuel = 1, #fuels, 1 do
@ -123,6 +143,20 @@ function updateSaws()
end end
end end
for check = 1, #checks, 1 do
checks[check]:setImage(loopCheck:image())
if #checks[check]:overlappingSprites() > 0 and checks[check].set == false then
for check = 1, #checks, 1 do
checks[check].set = false
end
setSpawn(checks[check].x,checks[check].y)
miniExplode(checks[check].x,checks[check].y)
sfxCollect:play()
checks[check].set = true
break
end
end
for b=1, #blades, 1 do for b=1, #blades, 1 do
b = blades[b] b = blades[b]
b.saw:setImage(loopSaws:image()) b.saw:setImage(loopSaws:image())
@ -181,6 +215,11 @@ function killBlades()
end end
fuels = {} fuels = {}
for check = 1, #checks, 1 do
checks[check]:remove()
end
checks = {}
for i = 1, #blades, 1 do for i = 1, #blades, 1 do
blades[i].t1:remove() blades[i].t1:remove()
blades[i].t2:remove() blades[i].t2:remove()

BIN
Source/gfx/checkp.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 174 B

BIN
Source/gfx/checkpEditor.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 275 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 930 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.1.3 version=1.2.0
buildNumber=1 buildNumber=10200
imagePath=launcher imagePath=launcher