Viewport es mou a l'abad
This commit is contained in:
@@ -153,6 +153,50 @@ function check_tile(hab,x,y)
|
||||
end
|
||||
end
|
||||
|
||||
function arc_mapa_get_coords ( hab, tile_x , tile_y )
|
||||
-- La primera habitació es la 0
|
||||
-- El primer tile es 0
|
||||
x = ((hab % 10)*mapa_room_cols + tile_x)*arcade_config.tiles_width
|
||||
y = (math.floor(hab/10)*mapa_room_rows + tile_y)*arcade_config.tiles_height
|
||||
|
||||
return x, y
|
||||
end
|
||||
|
||||
function arc_mapa_get_map_coords ( x, y )
|
||||
local tw = arcade_config.tiles_width
|
||||
local th = arcade_config.tiles_height
|
||||
local cols = mapa_room_cols
|
||||
local rows = mapa_room_rows
|
||||
local rooms_per_floor = mapa_rooms_per_piso
|
||||
|
||||
local calc_col = math.floor(x / tw) % cols
|
||||
local calc_row = math.floor(y / th) % rows
|
||||
local calc_room = math.floor(y / (th * rows))*rooms_per_floor+math.floor(x / (tw * cols))
|
||||
|
||||
return calc_room, calc_col, calc_row
|
||||
end
|
||||
|
||||
function arc_check_tile(x,y)
|
||||
-- local xx=math.min(11,math.max(0,math.floor(x/8)))
|
||||
-- local yy=math.min(5,math.max(0,math.floor(y/8)))
|
||||
--rect(xx*8,yy*8,xx*8+8,yy*8+8,3)
|
||||
local hab, xx, yy = arc_mapa_get_map_coords(x, y)
|
||||
local tile=mapa_get_tile(hab,xx,yy)
|
||||
if tile<8 then
|
||||
return tiletype.half
|
||||
elseif tile<15 then
|
||||
return tiletype.stair
|
||||
elseif tile==15 then
|
||||
return tiletype.switch
|
||||
elseif tile<64 then
|
||||
return tiletype.block
|
||||
elseif tile==111 then
|
||||
return tiletype.nonpc
|
||||
else
|
||||
return tiletype.void
|
||||
end
|
||||
end
|
||||
|
||||
pix={14,10,7,1,0,0,0,0,4,4,4,4,0,0,0,8,14,14,14,14,14,14,0,0,10,10,10,10,10,10,10,10,7,7,7,7,7,7,2,2,1,1,1,1,1,1,12,12,1,1,1,9,9,9,10,10,10,0,0,0,0,0,0,0}
|
||||
|
||||
function mapa_create_minimap()
|
||||
|
||||
Reference in New Issue
Block a user