2024-05-29 17:38:50 +03:00
|
|
|
-- CoreLibs
|
|
|
|
import "CoreLibs/object"
|
|
|
|
import "CoreLibs/graphics"
|
|
|
|
import "CoreLibs/sprites"
|
|
|
|
import "CoreLibs/timer"
|
|
|
|
import "CoreLibs/crank"
|
|
|
|
|
|
|
|
local pd <const> = playdate
|
|
|
|
local gfx <const> = pd.graphics
|
|
|
|
|
|
|
|
TAGS = {
|
|
|
|
Pickup = 1,
|
|
|
|
Player = 2,
|
|
|
|
Hazard = 3
|
|
|
|
}
|
|
|
|
|
|
|
|
Z_INDEXES = {
|
|
|
|
Ground = 100,
|
|
|
|
Pickup = 50,
|
|
|
|
Player = 20
|
|
|
|
}
|
|
|
|
|
|
|
|
local font = gfx.font.new('font/Mini Sans 2X')
|
|
|
|
|
|
|
|
gfx.setFont(font)
|
|
|
|
|
|
|
|
-- Libraries
|
|
|
|
import "lib/AnimatedSprite"
|
2024-05-31 13:19:42 +03:00
|
|
|
import "lib/pdParticles"
|
|
|
|
|
2024-05-29 17:38:50 +03:00
|
|
|
playdate.display.setRefreshRate(50)
|
|
|
|
|
|
|
|
-- Game
|
|
|
|
import "level"
|
|
|
|
|
|
|
|
level = nil
|
|
|
|
|
|
|
|
local function initialize()
|
|
|
|
-- Make it different, every time!
|
|
|
|
math.randomseed(playdate.getSecondsSinceEpoch())
|
|
|
|
|
|
|
|
-- Init all the things!
|
|
|
|
level = Level()
|
|
|
|
playdate.resetElapsedTime()
|
2024-05-31 13:19:42 +03:00
|
|
|
|
2024-05-29 17:38:50 +03:00
|
|
|
end
|
|
|
|
|
|
|
|
initialize()
|
|
|
|
|
|
|
|
function pd.update()
|
|
|
|
gfx.sprite.update()
|
|
|
|
pd.timer.updateTimers()
|
|
|
|
pd.drawFPS(10,0)
|
2024-05-31 13:19:42 +03:00
|
|
|
Particles:update()
|
2024-05-29 17:38:50 +03:00
|
|
|
|
|
|
|
if level then
|
|
|
|
level.update()
|
|
|
|
end
|
|
|
|
end
|