-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeadplayers.lua
More file actions
40 lines (34 loc) · 762 Bytes
/
Copy pathdeadplayers.lua
File metadata and controls
40 lines (34 loc) · 762 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
32
33
34
35
36
37
38
39
40
local count = 0
DeadPlayers = {}
local dp = DeadPlayers
local meta = {} --metatable is required to prevent indexing fields with functions via 'pairs'
setmetatable(dp, meta)
meta.__index = meta
meta.add = function(plyr)
if count >= config.MAX_GRAVES then
count = 0
end
count = count + 1
local t = love.timer.getTime()
dp[count] = {plyr.x, plyr.y, t + config.GRAVE_TIME}
end
-- meta.think = function(dt)
-- for _, v in pairs(np) do
-- v:think(dt)
-- end
-- end
meta.free = function()
local t = love.timer.getTime()
for k, v in pairs(dp) do
if v[3] < t then
dp[k] = nil
end
end
end
meta.draw = function()
for _, v in pairs(dp) do
local x, y = camera.ToScreen(v[1], v[2])
funcs.DrawEx(textures.grave, x, y)
end
end
return DeadPlayers