fixed level system
This commit is contained in:
parent
4393d2aa87
commit
d166085035
6 changed files with 43 additions and 6 deletions
|
@ -1,5 +1,6 @@
|
||||||
import "CoreLibs/graphics"
|
import "CoreLibs/graphics"
|
||||||
import "CoreLibs/sprites"
|
import "CoreLibs/sprites"
|
||||||
|
import "CoreLibs/ui"
|
||||||
import "Player"
|
import "Player"
|
||||||
import "Map"
|
import "Map"
|
||||||
import "Menu"
|
import "Menu"
|
||||||
|
@ -16,10 +17,13 @@ gfx.setBackgroundColor(gfx.kColorBlack)
|
||||||
|
|
||||||
local song1 <const> = playdate.sound.sampleplayer.new("sfx/song1")
|
local song1 <const> = playdate.sound.sampleplayer.new("sfx/song1")
|
||||||
song1:play(0, 1)
|
song1:play(0, 1)
|
||||||
|
local imgCrank = gfx.image.new("gfx/crank")
|
||||||
|
|
||||||
gfx.setColor(gfx.kColorWhite)
|
gfx.setColor(gfx.kColorWhite)
|
||||||
-- {"START NEW GAME","CONTINUE","USER LEVELS", "EXIT"}
|
-- {"START NEW GAME","CONTINUE","USER LEVELS", "EXIT"}
|
||||||
|
|
||||||
|
mainMenuCreation()
|
||||||
|
|
||||||
createMenu(mainmenu)
|
createMenu(mainmenu)
|
||||||
|
|
||||||
local menu = playdate.getSystemMenu()
|
local menu = playdate.getSystemMenu()
|
||||||
|
|
|
@ -6,6 +6,7 @@ local index = 0
|
||||||
|
|
||||||
local menuitems = {}
|
local menuitems = {}
|
||||||
local menu = null
|
local menu = null
|
||||||
|
local page = 0
|
||||||
|
|
||||||
local imgCursor = gfx.image.new("gfx/cursor")
|
local imgCursor = gfx.image.new("gfx/cursor")
|
||||||
local imgBytes = gfx.image.new("gfx/bytes")
|
local imgBytes = gfx.image.new("gfx/bytes")
|
||||||
|
@ -23,8 +24,6 @@ function mainMenuCreation()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
mainMenuCreation()
|
|
||||||
|
|
||||||
function createMenu(items)
|
function createMenu(items)
|
||||||
killPlayer()
|
killPlayer()
|
||||||
mode = "menu"
|
mode = "menu"
|
||||||
|
@ -68,6 +67,29 @@ function updateMenu()
|
||||||
imgBytes:draw(0,0)
|
imgBytes:draw(0,0)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function customLoad()
|
||||||
|
local lvls = playdate.file.listFiles("levels")
|
||||||
|
local m = {}
|
||||||
|
m[0], m[1] = "customs", "BACK"
|
||||||
|
if #lvls - (1 + (7*page)) <= 0 then page = 0 end
|
||||||
|
if #lvls < 7 then
|
||||||
|
for i = 1, #lvls, 1 do
|
||||||
|
m[i+1] = lvls[i]:upper()
|
||||||
|
end
|
||||||
|
elseif lvls[1 + (7*page)] then
|
||||||
|
m[2] = "NEXT PAGE"
|
||||||
|
for i = 1, 7, 1 do
|
||||||
|
if lvls[i+(7*page)] then
|
||||||
|
m[i+2] = lvls[i+(7*page)]:upper()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
createMenu(m)
|
||||||
|
|
||||||
|
index = #lvls
|
||||||
|
end
|
||||||
|
|
||||||
function menuButtonPress(name)
|
function menuButtonPress(name)
|
||||||
if name == "START NEW GAME" and menu == "mainPlay" then
|
if name == "START NEW GAME" and menu == "mainPlay" then
|
||||||
local m = {}
|
local m = {}
|
||||||
|
@ -85,7 +107,17 @@ function menuButtonPress(name)
|
||||||
m[0],m[1] = "about", "BACK"
|
m[0],m[1] = "about", "BACK"
|
||||||
createMenu(m)
|
createMenu(m)
|
||||||
|
|
||||||
|
elseif name == "USER LEVELS" then
|
||||||
|
page = 0
|
||||||
|
customLoad()
|
||||||
|
elseif name == "NEXT PAGE" then
|
||||||
|
page += 1
|
||||||
|
customLoad()
|
||||||
|
|
||||||
elseif name == "BACK" or name == "CANCEL" then
|
elseif name == "BACK" or name == "CANCEL" then
|
||||||
createMenu(mainmenu)
|
createMenu(mainmenu)
|
||||||
|
|
||||||
|
elseif menu == "customs" then
|
||||||
|
addMap("levels/"..name)
|
||||||
end
|
end
|
||||||
end
|
end
|
|
@ -77,8 +77,8 @@ function updatePlayer()
|
||||||
end
|
end
|
||||||
local cx, cy = gfx.getDrawOffset()
|
local cx, cy = gfx.getDrawOffset()
|
||||||
gfx.setDrawOffset(playdate.math.lerp(cx,(-sprRocket.x + 200), lerpmnt), playdate.math.lerp(cy,(-sprRocket.y + 120), lerpmnt))
|
gfx.setDrawOffset(playdate.math.lerp(cx,(-sprRocket.x + 200), lerpmnt), playdate.math.lerp(cy,(-sprRocket.y + 120), lerpmnt))
|
||||||
end
|
|
||||||
|
|
||||||
|
end
|
||||||
updateExit()
|
updateExit()
|
||||||
|
|
||||||
sprRocket:setScale(scale,scale)
|
sprRocket:setScale(scale,scale)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
--metrics={"baseline":26,"xHeight":2,"capHeight":2,"pairs":{},"left":[],"right":[]}
|
--metrics={"baseline":26,"xHeight":2,"capHeight":2,"pairs":{},"left":[],"right":[]}
|
||||||
datalen=3208
|
datalen=3212
|
||||||
data=iVBORw0KGgoAAAANSUhEUgAAAHAAAAB+CAYAAAD86pU7AAAJLElEQVR4Xu1d7WLsKgg8ff+H7ul+JFUDzoBoki73V29XIzIMDJo9/fp3/O9b+N3jV1/K79tfb/Ot49vnoPlWOzW7kL3aOqy9XjuRu5/+kZxkXTABfHlACzirP00BUy76nPj9Lc//+tqHdg3d5lvHH8JZX89qZzW+sOu5ZMfe7jqEvUN2Qvq9/ZMAvgNWCLjbAEhF6BYR7EY7DOyut60jMENjTBWs1nksA1vmCgzZyODdXzVfY2Br72NSAvgoYMeUTQFROPq2AO6kATUFiZ2q+CJmsBHqYLQJCEG8eIFHZU98bgQDE8Da9dcAsGUAoS41w6l+rlW/bA0dVYOj81Hq1WhFqHSKGCoDE8C9r5vSDkwDUFCbqF+iIkWIRJRqrI0xslNscNnMElVzOzW53S+V0Q4MTAAPJyrdkxFr23JFAJF63GPi/QNi3qEsWeYRjGIzBmXnBAAp5pVOFXO89cgJyfVCblOOmdBfiW0Malc0gNB+H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R12RhwfwHAVEYYjBVVJGKQkKUo8bLNKwB1RRgFPsr4bl4TKOaRXAaAXoNXOya6XnSe1x9cU2GcxGQtyG6YHff0I7HZfVLAzhylzeZ87wa941fbl0UECri2BnaO2T/Q/z3Lq5hRAAqez7hOEiPdq9ZOHL/aPk2MuJjFDi4AsaeiF7PRediiZgR7aWs9dNbQbf64RoZtLmc8cXCGkwrAC5GXUigLaqqoONDPL6IudON1SxeA1/k+ZeVDH0i8CzPb72jM7TYUOENMccjTHlIAPg2xwd7LU6jQ/83W1odD4jO/APT563ajWcUpGZ7NlOzn3c7ZZxhUAJ7h1YXPvDKFzqrZhW6671IF4H2xoSybaSM6BglqkjKgGcQeybHjvOs/cnwB+EjYfox+UgotlSoEWwH4ixgY3UpWTWKfw46L7udR82b6wBIxN4D6fyb0Dzl//3W/AAAAAElFTkSuQmCC
|
||||||
width=14
|
width=14
|
||||||
height=18
|
height=18
|
||||||
|
|
||||||
|
@ -57,4 +57,5 @@ Z 14
|
||||||
: 6
|
: 6
|
||||||
! 6
|
! 6
|
||||||
? 14
|
? 14
|
||||||
|
. 14
|
||||||
|
|
||||||
|
|
BIN
Source/gfx/crank.png
Normal file
BIN
Source/gfx/crank.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.3 KiB |
Loading…
Reference in a new issue