-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheckpointInit.lua
More file actions
31 lines (22 loc) · 875 Bytes
/
Copy pathcheckpointInit.lua
File metadata and controls
31 lines (22 loc) · 875 Bytes
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
-- Some glue to make STI and checkpoint.lua stick together
-- Overall not very nice code
checkpointInit = {}
-- Create checkpoint objects from Tiled stuff
function checkpointInit.initLayer(map, layer, _, player)
local objects = map.layers[layer].objects
local checkpointList = {}
for _, object in pairs(objects) do
local checkpoint = love.filesystem.load("checkpoint.lua")()
checkpoint.name = object.name
checkpoint:load(player, object.x + map.tilewidth/2,
object.y - map.tileheight/2, object.width, object.height)
checkpointList[#checkpointList +1] = checkpoint
if object.name then
checkpointList[object.name] = checkpoint
end
end
-- Tell STI that we're handling stuff
map:convertToCustomLayer(layer)
return checkpointList
end
return checkpointInit