import "CoreLibs/graphics" import "CoreLibs/sprites" import "Player" import "Map" import "Menu" mode = "menu" local gfx = playdate.graphics local disp = playdate.display local font = gfx.font.new("gfx/big") gfx.setFont(font) gfx.setBackgroundColor(gfx.kColorBlack) local song1 = playdate.sound.sampleplayer.new("sfx/song1") song1:play(0, 1) gfx.setColor(gfx.kColorWhite) -- {"START NEW GAME","CONTINUE","USER LEVELS", "EXIT"} local mainmenu = {} if playdate.datastore.read("savegame") then mainmenu[4],mainmenu[3],mainmenu[2],mainmenu[1], mainmenu[0] = "START NEW GAME", "CONTINE", "USER LEVELS", "ABOUT THE CREATOR", "mainPlay" else mainmenu[3],mainmenu[2],mainmenu[1], mainmenu[0] = "START NEW GAME", "USER LEVELS", "ABOUT THE CREATOR", "mainNoPlay" end createMenu(mainmenu) local menu = playdate.getSystemMenu() local menuItem, error = menu:addMenuItem("Main Menu", function() createMenu(mainmenu) end) addMap("levels/level.json") function playdate.update() if mode == "menu" then updateMenu() elseif mode == "game" then updatePlayer() gfx.clear(gfx.kColorBlack) gfx.sprite.update() drawTiles() end end