2022-04-17 19:27:36 +00:00
|
|
|
import "CoreLibs/graphics"
|
|
|
|
import "CoreLibs/sprites"
|
2022-04-24 03:25:48 +00:00
|
|
|
import "CoreLibs/ui"
|
2022-04-19 21:22:15 +00:00
|
|
|
import "Player"
|
2022-04-19 21:32:18 +00:00
|
|
|
import "Map"
|
2022-04-22 18:48:45 +00:00
|
|
|
import "Menu"
|
2022-04-24 05:03:32 +00:00
|
|
|
import "Saws"
|
2022-04-22 18:48:45 +00:00
|
|
|
|
2022-04-23 06:54:45 +00:00
|
|
|
mode = "menu"
|
2022-04-23 21:48:23 +00:00
|
|
|
map = "levels/level1.json"
|
2022-04-19 21:32:18 +00:00
|
|
|
|
2022-04-22 18:02:47 +00:00
|
|
|
local gfx <const> = playdate.graphics
|
2022-04-19 21:32:18 +00:00
|
|
|
local disp <const> = playdate.display
|
2022-04-23 05:50:57 +00:00
|
|
|
local font <const> = gfx.font.new("gfx/big")
|
2022-04-22 18:48:45 +00:00
|
|
|
|
2022-04-17 19:27:36 +00:00
|
|
|
gfx.setFont(font)
|
|
|
|
gfx.setBackgroundColor(gfx.kColorBlack)
|
|
|
|
|
2022-04-19 21:32:18 +00:00
|
|
|
local song1 <const> = playdate.sound.sampleplayer.new("sfx/song1")
|
2022-04-17 19:27:36 +00:00
|
|
|
song1:play(0, 1)
|
2022-04-24 03:25:48 +00:00
|
|
|
local imgCrank = gfx.image.new("gfx/crank")
|
2022-04-17 19:27:36 +00:00
|
|
|
|
2022-04-22 18:48:45 +00:00
|
|
|
gfx.setColor(gfx.kColorWhite)
|
2022-04-23 05:50:57 +00:00
|
|
|
-- {"START NEW GAME","CONTINUE","USER LEVELS", "EXIT"}
|
2022-04-23 21:48:23 +00:00
|
|
|
|
2022-04-24 03:25:48 +00:00
|
|
|
mainMenuCreation()
|
|
|
|
|
2022-04-23 05:50:57 +00:00
|
|
|
createMenu(mainmenu)
|
2022-04-22 18:48:45 +00:00
|
|
|
|
2022-04-23 06:54:45 +00:00
|
|
|
local menu = playdate.getSystemMenu()
|
|
|
|
local menuItem, error = menu:addMenuItem("Main Menu", function()
|
2022-04-23 21:48:23 +00:00
|
|
|
mainMenuCreation()
|
2022-04-23 06:54:45 +00:00
|
|
|
createMenu(mainmenu)
|
|
|
|
end)
|
2022-04-17 19:27:36 +00:00
|
|
|
|
2022-04-23 21:48:23 +00:00
|
|
|
--addMap("levels/level.json")
|
2022-04-17 19:27:36 +00:00
|
|
|
|
2022-04-19 21:22:15 +00:00
|
|
|
function playdate.update()
|
2022-04-22 18:48:45 +00:00
|
|
|
if mode == "menu" then
|
|
|
|
updateMenu()
|
2022-04-17 19:27:36 +00:00
|
|
|
|
2022-04-22 18:48:45 +00:00
|
|
|
elseif mode == "game" then
|
|
|
|
updatePlayer()
|
2022-04-17 19:27:36 +00:00
|
|
|
|
2022-04-22 18:48:45 +00:00
|
|
|
gfx.clear(gfx.kColorBlack)
|
|
|
|
gfx.sprite.update()
|
|
|
|
drawTiles()
|
|
|
|
end
|
2022-04-17 19:27:36 +00:00
|
|
|
end
|