bzr branch
http://9ix.org/bzr/ld28
11
by Josh C
... add the map. and the extra code to work w/ it. |
1 |
util = { |
2 |
dim = function(dir) |
|
3 |
if dir == 'x' then |
|
4 |
return 'width' |
|
5 |
elseif dir == 'y' then |
|
6 |
return 'height' |
|
7 |
else |
|
8 |
if STRICT then error('dir '..dir) end |
|
9 |
end |
|
10 |
end, |
|
11 |
dirToXY = function(dir) |
|
12 |
if dir == 'up' or dir == 'down' then |
|
13 |
return 'y' |
|
14 |
elseif dir == 'left' or dir == 'right' then |
|
15 |
return 'x' |
|
16 |
else |
|
17 |
error('bad direction') |
|
18 |
end |
|
19 |
end, |
|
20 |
dirToPosNeg = function(dir) |
|
21 |
if dir == 'up' or dir == 'left' then |
|
22 |
return -1 |
|
23 |
elseif dir == 'down' or dir == 'right' then |
|
24 |
return 1 |
|
25 |
else |
|
26 |
error('bad direction') |
|
27 |
end |
|
28 |
end |
|
29 |
} |