2024-06-01 16:52:11 +03:00
|
|
|
local pd <const> = playdate
|
|
|
|
local gfx <const> = Graphics
|
|
|
|
|
|
|
|
BaseScene = {}
|
|
|
|
class("BaseScene").extends(NobleScene)
|
|
|
|
|
|
|
|
function BaseScene:init()
|
|
|
|
BaseScene.super.init(self)
|
|
|
|
|
2024-06-14 20:33:09 +03:00
|
|
|
pd.resetElapsedTime() -- Reset time so each scene starts at 0
|
|
|
|
self.optionsMenu = pd.getSystemMenu() -- Store this so we have access to it in all scenes
|
2024-06-01 16:52:11 +03:00
|
|
|
end
|
|
|
|
|
|
|
|
function BaseScene:update()
|
|
|
|
BaseScene.super.update(self)
|
2024-06-14 20:33:09 +03:00
|
|
|
Particles:update()
|
2024-06-01 16:52:11 +03:00
|
|
|
end
|
|
|
|
|
|
|
|
function BaseScene:exit()
|
|
|
|
BaseScene.super.exit(self)
|
2024-06-14 20:33:09 +03:00
|
|
|
self.optionsMenu:removeAllMenuItems() -- Remove all custom menu items and reset menu image
|
2024-06-01 16:52:11 +03:00
|
|
|
pd.setMenuImage(nil)
|
|
|
|
end
|
|
|
|
|
|
|
|
function BaseScene:drawBackground()
|
2024-06-14 20:33:09 +03:00
|
|
|
BaseScene.super.drawBackground(self)
|
2024-06-01 16:52:11 +03:00
|
|
|
|
2024-06-14 20:33:09 +03:00
|
|
|
if self.background ~= nil then -- Helper so you can set a scene's background to an image
|
2024-06-01 16:52:11 +03:00
|
|
|
self.background:draw(0, 0)
|
|
|
|
end
|
2024-06-14 20:33:09 +03:00
|
|
|
end
|