-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathminimap.lua
More file actions
38 lines (24 loc) · 934 Bytes
/
minimap.lua
File metadata and controls
38 lines (24 loc) · 934 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
local minimap = {}
function minimap.minimap(screen, map, players, location, scale_factor, lookahead)
local minimap = {}
local function drawBox(b)
love.graphics.rectangle('line', b.x - screen.x, screen.dy - (b.y + b.dy - screen.y), b.dx, b.dy)
end
local function drawMiniBox(o)
local b = { x = location.x + o.x / scale_factor, y = location.y + o.y / scale_factor, dx = o.dx / scale_factor, dy = o.dy / scale_factor }
love.graphics.rectangle('line', -screen.x / scale_factor + b.x, -screen.y / scale_factor + screen.dy - b.y - b.dy, b.dx, b.dy)
end
function minimap.update(dt)
end
function minimap.draw()
drawMiniBox(screen)
for i, o in ipairs(map.obstaclesAround(screen, lookahead)) do
drawMiniBox(o)
end
for i, p in ipairs(players) do
drawMiniBox(p)
end
end
return minimap
end
return minimap