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 prevtext = ""
local levelname = nil
local inverted = false
local tileTable <const> = gfx.imagetable.new("gfx/tiles")
local tilemapEditor = gfx.tilemap.new()
@ -27,6 +26,8 @@ local editorSongs = {"song1","song2","song5", "song6", "song7", "song8"}
local selSong = "song2"
local songIndexSel = 10
local grav = 0.2
local imgFloppy = gfx.imagetable.new("gfx/floppyT")
local imgAdd = gfx.image.new("gfx/add")
local imgMus = gfx.image.new("gfx/music")
@ -101,8 +102,8 @@ function editLoadName(name)
exitPos = {x = data.bigrocket.x, y = data.bigrocket.y}
position = {x = (data.rocket.x + 6) / 16, y = (data.rocket.y + 4)/16}
levelname = name:match("(.+)%..+$")
inverted = data.inverted
playdate.display.setInverted(data.inverted)
grav = data.grav or 0.2
saveTime = 0
-- loading tiles
@ -110,9 +111,9 @@ function editLoadName(name)
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}
end
altClrButton = playdate.getSystemMenu():addCheckmarkMenuItem("alt colours",inverted, function(value)
playdate.display.setInverted(value)
inverted = value
altClrButton = playdate.getSystemMenu():addMenuItem("level settings", function()
local m = {"NO GRAVITY","NEGATIVE GRAVITY","REGULAR GRAVITY","INVERT COLOURS","RESUME"}
createMenu(m, true)
end)
toolTipButton = playdate.getSystemMenu():addMenuItem("save", function()
editSave()
@ -132,13 +133,13 @@ function playdate.keyboard.keyboardWillHideCallback(ok)
position = {x=89,y=93}
playerPos = {x=1562,y=1564}
exitPos = {x = 1616, y = 1536}
inverted = false
playdate.display.setInverted(false)
saveTime = 0
grav=0.2
song:stop()
playdate.getSystemMenu():addCheckmarkMenuItem("alt colours",false, function(value)
playdate.display.setInverted(value)
inverted = value
playdate.getSystemMenu():addCheckmarkMenuItem("level settings", function()
local m = {"NO GRAVITY","NEGATIVE GRAVITY","REGULAR GRAVITY","INVERT LEVEL COLOURS","RESUME"}
createMenu(m, true)
end)
playdate.getSystemMenu():addMenuItem("save",false, function()
editSave()
@ -172,7 +173,7 @@ local curYlerp = -32
function editSave()
playdate.datastore.delete("levels/"..levelname..".json")
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
local traveltime = 1
@ -334,6 +335,7 @@ function editUpdate()
end
end
if editor ~= "settings" then
if playdate.buttonJustPressed(playdate.kButtonLeft) then
if editor ~= "pos2Spin" then
position.x -= 1
@ -363,6 +365,9 @@ function editUpdate()
end
end
end
if position.x + 11 < 0 then position.x = -11 end
if position.y + 7 < 0 then position.y = -7 end
@ -534,3 +539,13 @@ function editClose()
playdate.getSystemMenu():removeMenuItem(playdate.getSystemMenu():getMenuItems()[2])
end
end
function setGrav(val)
grav = val
end
local gravs = {[0.2]="REGULAR",[0]="NONE",[-0.2]="NEGATIVE"}
function getGrav()
return gravs[grav]
end

View file

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

View file

@ -49,7 +49,7 @@ function createMenu(items, invert)
killBlades()
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
@ -74,7 +74,7 @@ end
function updateMenu()
gfx.clear(gfx.kColorBlack)
processStars(-10,-10)
sidebar:draw(barposLerp,0)
-- input
local change, aChange = playdate.getCrankChange()
@ -86,6 +86,15 @@ function updateMenu()
sfxSelect:play()
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
if math.floor(index) < 0 then index = #menuitems -0.01 end
@ -116,8 +125,6 @@ function updateMenu()
sfxAccept:play()
end
imgBytes:draw(logposLerp,0)
if menu == "qrs" then
imgQRs:draw(0,0)
small:drawText("BY POSSIBLYAXOLOTL :)".."\nV."..playdate.metadata.version,0,0)
@ -217,6 +224,19 @@ function menuButtonPress(name, index)
addMap(map)
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
local m = {"BACK","WATCH START CUTSCENE"}
m[0] = "dat"
@ -230,6 +250,13 @@ function menuButtonPress(name, index)
elseif name == "WATCH END CUTSCENE" then
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
local m = {}
--barpos = 160

View file

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