-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.lua
50 lines (36 loc) · 949 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
41
42
43
44
45
46
47
48
49
50
import "CoreLibs/object"
import "CoreLibs/graphics"
import "CoreLibs/sprites"
import "CoreLibs/timer"
import "player"
import "screenShake"
local pd <const> = playdate
local gfx <const> = pd.graphics
local screenShakeSprite = ScreenShake()
local playerSprite = nil
function setShakeAmount(amount)
screenShakeSprite:setShakeAmount(amount)
end
local function initialize()
math.randomseed(pd.getSecondsSinceEpoch())
Player(200, 120)
items = gfx.imagetable.new("images/items")
print("Total items loaded: " .. items:getLength())
-- for n=1, items:getSize() do
-- items:drawImage(n,10,10+n*16)
-- i:add()
-- end
setShakeAmount(10)
local backgroundImage = gfx.image.new("images/background")
gfx.sprite.setBackgroundDrawingCallback(
function(x, y, width, height)
gfx.setClipRect(x, y, width, height)
backgroundImage:draw(0, 0)
gfx.clearClipRect()
end
)
end
initialize()
function pd.update()
gfx.sprite.update()
end