-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathutils.lua
More file actions
37 lines (32 loc) · 763 Bytes
/
Copy pathutils.lua
File metadata and controls
37 lines (32 loc) · 763 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
-->8
-- random utils
function setup_palette()
pal()
_pal={0,129,136,140,1,5,6,7,8,135,10,131,12,13,133,134}
for i,c in pairs(_pal) do
pal(i-1,c,1)
end
end
function currently_clearing_blocks()
return blocks_clearing and costatus(blocks_clearing) ~= 'dead'
end
function for_all_tiles(callback)
for y = 1, board_height do
for x = 1, board_width do
if board[y][x] ~= wall then
callback(y, x)
end
end
end
end
function is_odd(num)
return num % 2 ~= 0
end
function get_screen_position_for_block(y,x)
local x_loc=x*piece_width + board_left
if is_odd(y) then
x_loc += piece_width/2
end
local y_loc=bottom-y*piece_height
return y_loc, x_loc
end