-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_area.lua
60 lines (55 loc) · 1.61 KB
/
test_area.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
51
52
53
54
55
56
57
58
59
60
map_config = {
tileset = "resources/images/zelda_tiles.png",
tile_size = 16,
map_width = 8,
map_height = 8,
tilemap = {
undrawn_tiles = {0, 1, 2},
collision_tiles = {0, 1, 2},
layers = {
{209, 209, 209, 209, 209, 209, 209, 209,
209, 209, 209, 209, 209, 209, 209, 209,
209, 209, 0, 0, 0, 0, 209, 209,
209, 209, 0, 0, 0, 0, 209, 209,
209, 209, 0, 0, 0, 0, 209, 209,
209, 209, 0, 0, 0, 0, 209, 209,
209, 209, 209, 209, 209, 209, 209, 209,
209, 209, 209, 209, 209, 209, 209, 209},
{ 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 005, 006, 006, 007, 0, 0,
0, 0, 008, 0, 0, 009, 0, 0,
0, 0, 008, 0, 0, 009, 0, 0,
0, 0, 010, 011, 011, 012, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0},
{ 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 112, 113, 0, 0, 0,
0, 0, 0, 128, 129, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0}
}
}
}
function update_tiles()
for k, layer in pairs(map_config.tilemap.layers) do
for i, v in pairs(layer) do
if v == 209 then
layer[i] = 210
elseif v == 210 then
layer[i] = 209
end
end
end
reload_map()
end
last_updated = 0
function update_area(milliseconds)
if milliseconds - last_updated > 500 then
update_tiles()
last_updated = milliseconds
end
end