-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmap.lua
44 lines (37 loc) · 850 Bytes
/
map.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
require "tile"
function Map(w, h)
local m = {}
m.w = w
m.h = h
m.data = {}
function m:genEmptyMap()
self.data = {}
for y=1, self.h do
self.data[y] = {}
for x=1, self.w do
self.data[y][x] = 0
end
end
end
function m:draw()
for y=1, self.h do
for x=1, self.w do
if self.data[y][x] ~= nil and self.data[y][x] ~= 0 then
self.data[y][x]:draw()
end
end
end
end
return m
end
function initMap()
world_map = Map(40, 30)
world_map:genEmptyMap()
end
function drawGround()
local width = love.graphics.getWidth()
local height = love.graphics.getHeight()
love.graphics.setColor(0.6, 0.6, 0.6)
love.graphics.rectangle("fill", 0, height-GROUND, width, GROUND)
love.graphics.setColor(1, 1, 1)
end