This commit is contained in:
PossiblyAxolotl 2022-08-01 00:58:11 -06:00
parent ea39499a43
commit ea719c7632
4 changed files with 60 additions and 18 deletions

View file

@ -1,7 +1,6 @@
local gfx <const> = playdate.graphics local gfx <const> = playdate.graphics
local prevtext = "" local prevtext = ""
local levelname = nil local levelname = nil
local inverted = false
local tileTable <const> = gfx.imagetable.new("gfx/tiles") local tileTable <const> = gfx.imagetable.new("gfx/tiles")
local tilemapEditor = gfx.tilemap.new() local tilemapEditor = gfx.tilemap.new()
@ -27,6 +26,8 @@ local editorSongs = {"song1","song2","song5", "song6", "song7", "song8"}
local selSong = "song2" local selSong = "song2"
local songIndexSel = 10 local songIndexSel = 10
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/music")
@ -101,8 +102,8 @@ function editLoadName(name)
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}
levelname = name:match("(.+)%..+$") levelname = name:match("(.+)%..+$")
inverted = data.inverted
playdate.display.setInverted(data.inverted) playdate.display.setInverted(data.inverted)
grav = data.grav or 0.2
saveTime = 0 saveTime = 0
-- loading tiles -- loading tiles
@ -110,9 +111,9 @@ function editLoadName(name)
tilemapEditor:setTileAtPosition(data.tiles[tile].x,data.tiles[tile].y,data.tiles[tile].t) tilemapEditor:setTileAtPosition(data.tiles[tile].x,data.tiles[tile].y,data.tiles[tile].t)
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():addCheckmarkMenuItem("alt colours",inverted, function(value) altClrButton = playdate.getSystemMenu():addMenuItem("level settings", function()
playdate.display.setInverted(value) local m = {"NO GRAVITY","NEGATIVE GRAVITY","REGULAR GRAVITY","INVERT COLOURS","RESUME"}
inverted = value createMenu(m, true)
end) end)
toolTipButton = playdate.getSystemMenu():addMenuItem("save", function() toolTipButton = playdate.getSystemMenu():addMenuItem("save", function()
editSave() editSave()
@ -132,13 +133,13 @@ function playdate.keyboard.keyboardWillHideCallback(ok)
position = {x=89,y=93} position = {x=89,y=93}
playerPos = {x=1562,y=1564} playerPos = {x=1562,y=1564}
exitPos = {x = 1616, y = 1536} exitPos = {x = 1616, y = 1536}
inverted = false
playdate.display.setInverted(false) playdate.display.setInverted(false)
saveTime = 0 saveTime = 0
grav=0.2
song:stop() song:stop()
playdate.getSystemMenu():addCheckmarkMenuItem("alt colours",false, function(value) playdate.getSystemMenu():addCheckmarkMenuItem("level settings", function()
playdate.display.setInverted(value) local m = {"NO GRAVITY","NEGATIVE GRAVITY","REGULAR GRAVITY","INVERT LEVEL COLOURS","RESUME"}
inverted = value createMenu(m, true)
end) end)
playdate.getSystemMenu():addMenuItem("save",false, function() playdate.getSystemMenu():addMenuItem("save",false, function()
editSave() editSave()
@ -172,7 +173,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, tiles = tiles, inverted = inverted, 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(), rocket=playerPos, bigrocket=exitPos, fuel = powers,saws=sawblades,rotators=spins},"levels/"..levelname)
end end
local traveltime = 1 local traveltime = 1
@ -184,7 +185,7 @@ function editUpdate()
local change, aChange = playdate.getCrankChange() local change, aChange = playdate.getCrankChange()
tileIndex += change * 0.01 tileIndex += change * 0.01
if editor == "main" then if editor == "main" then
if tileIndex > 7.9 then tileIndex = 0 end if tileIndex > 7.9 then tileIndex = 0 end
if tileIndex < 0 then tileIndex = 7.9 end if tileIndex < 0 then tileIndex = 7.9 end
@ -334,6 +335,7 @@ function editUpdate()
end end
end end
if editor ~= "settings" then
if playdate.buttonJustPressed(playdate.kButtonLeft) then if playdate.buttonJustPressed(playdate.kButtonLeft) then
if editor ~= "pos2Spin" then if editor ~= "pos2Spin" then
position.x -= 1 position.x -= 1
@ -363,6 +365,9 @@ function editUpdate()
end end
end end
end
if position.x + 11 < 0 then position.x = -11 end if position.x + 11 < 0 then position.x = -11 end
if position.y + 7 < 0 then position.y = -7 end if position.y + 7 < 0 then position.y = -7 end
@ -451,7 +456,7 @@ function editUpdate()
gfx.setColor(gfx.kColorWhite) gfx.setColor(gfx.kColorWhite)
gfx.drawLine(360,0,360,240) gfx.drawLine(360,0,360,240)
-- draw changes -- draw changes
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)
@ -533,4 +538,14 @@ function editClose()
playdate.getSystemMenu():removeMenuItem(playdate.getSystemMenu():getMenuItems()[3]) playdate.getSystemMenu():removeMenuItem(playdate.getSystemMenu():getMenuItems()[3])
playdate.getSystemMenu():removeMenuItem(playdate.getSystemMenu():getMenuItems()[2]) playdate.getSystemMenu():removeMenuItem(playdate.getSystemMenu():getMenuItems()[2])
end end
end
function setGrav(val)
grav = val
end
local gravs = {[0.2]="REGULAR",[0]="NONE",[-0.2]="NEGATIVE"}
function getGrav()
return gravs[grav]
end end

View file

@ -68,7 +68,7 @@ menuButton, error = menu:addMenuItem("game menu", function()
if mode == "game" then if mode == "game" then
playdate.datastore.delete("savegame.json") playdate.datastore.delete("savegame.json")
playdate.datastore.write({savedLevel=map,savedDeaths=deaths},"savegame") playdate.datastore.write({savedLevel=map,savedDeaths=deaths},"savegame")
elseif mode == "editor" then elseif mode == "editor" or page == -1 then
editClose() editClose()
song:play(0) song:play(0)
elseif mode == "startCutscene" or mode == "endCutscene" then elseif mode == "startCutscene" or mode == "endCutscene" then

View file

@ -49,7 +49,7 @@ function createMenu(items, invert)
killBlades() killBlades()
killPlayer() killPlayer()
if invert then playdate.display.setInverted(true) else playdate.display.setInverted(false) end if invert ~= true then playdate.display.setInverted(false) end
controlX = -80 controlX = -80
@ -74,7 +74,7 @@ end
function updateMenu() function updateMenu()
gfx.clear(gfx.kColorBlack) gfx.clear(gfx.kColorBlack)
processStars(-10,-10) processStars(-10,-10)
sidebar:draw(barposLerp,0)
-- input -- input
local change, aChange = playdate.getCrankChange() local change, aChange = playdate.getCrankChange()
@ -86,6 +86,15 @@ function updateMenu()
sfxSelect:play() sfxSelect:play()
end end
if menuitems[1].name == "NO GRAVITY" then
local str = {[true]="TRUE",[false]="FALSE"}
page = -1
gfx.drawText("INVERTED: "..str[playdate.display.getInverted()].."\nGRAVITY: "..getGrav(),0,0)
else
sidebar:draw(barposLerp,0)
imgBytes:draw(logposLerp,0)
end
index += change * 0.01 index += change * 0.01
if math.floor(index) < 0 then index = #menuitems -0.01 end if math.floor(index) < 0 then index = #menuitems -0.01 end
@ -116,8 +125,6 @@ function updateMenu()
sfxAccept:play() sfxAccept:play()
end end
imgBytes:draw(logposLerp,0)
if menu == "qrs" then if menu == "qrs" then
imgQRs:draw(0,0) imgQRs:draw(0,0)
small:drawText("BY POSSIBLYAXOLOTL :)".."\nV."..playdate.metadata.version,0,0) small:drawText("BY POSSIBLYAXOLOTL :)".."\nV."..playdate.metadata.version,0,0)
@ -217,6 +224,19 @@ function menuButtonPress(name, index)
addMap(map) addMap(map)
mode = "game" mode = "game"
elseif name == "NO GRAVITY" then
setGrav(0)
barpos = 160
logopos = -112
elseif name == "NEGATIVE GRAVITY" then
setGrav(-0.2)
barpos = 160
logopos = -112
elseif name == "REGULAR GRAVITY" then
setGrav(0.2)
barpos = 160
logopos = -112
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"
@ -230,6 +250,13 @@ function menuButtonPress(name, index)
elseif name == "WATCH END CUTSCENE" then elseif name == "WATCH END CUTSCENE" then
beginEndCutscene() beginEndCutscene()
elseif name == "RESUME" then
mode = "editor"
elseif name == "INVERT COLOURS" then
barpos = 160
logopos = -112
playdate.display.setInverted(not playdate.display.getInverted())
elseif name == "EXTRAS" then elseif name == "EXTRAS" then
local m = {} local m = {}
--barpos = 160 --barpos = 160

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.0.2 version=1.1.0
buildNumber=1 buildNumber=1
imagePath=launcher imagePath=launcher