-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.lua
40 lines (31 loc) · 865 Bytes
/
main.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import "CoreLibs/object"
import "CoreLibs/graphics"
import "CoreLibs/animation"
import "CoreLibs/sprites"
import "CoreLibs/timer"
local pd <const> = playdate
local gfx <const> = pd.graphics
local geo <const> = pd.geometry
local vector2D <const> = geo.vector2D
import "scripts/player"
-- Util functions
function clamp(n, low, high)
return math.min(math.max(low, n), high)
end
function shouldDrawSprite(s)
return pd.display:getRect():intersects(s:getBoundsRect())
end
-- State
local player = Player(60, -27)
function initialize()
-- Use all extra time per frame to run the garbage collector
pd.setGCScaling(0, 0)
-- Use the Lua GC mode that's optimized for short lived tiny objects
collectgarbage("generational")
end
function pd.update()
gfx.animation.blinker.updateAll()
gfx.sprite.update()
pd.drawFPS()
end
initialize()