[WIP] Moviment de l'Abad pel mapa

This commit is contained in:
2026-03-21 23:59:21 +01:00
parent 2900f98ad7
commit 57bd5bef4e
5 changed files with 372 additions and 205 deletions

View File

@@ -132,26 +132,31 @@ function mapa_cycle_colors(hab)
end
end
function check_tile(hab,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 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
-- function check_tile(hab,x,y)
-- msg_print(0,35,"c_t( "..hab..", "..x..", "..y.." )")
-- print("c_t( "..hab..", "..x..", "..y.." )")
-- -- local xx=math.min(11,math.max(0,math.floor(x/16)))
-- -- local yy=math.min(5,math.max(0,math.floor(y/16)))
-- --rect(xx*8,yy*8,xx*8+8,yy*8+8,3)
--
-- -- tiletype => void=0 / nonpc=1 / stair=2 /
-- -- switch=3 / half=4 / block=5
--
-- local tile=mapa_get_tile(hab,x,y)
-- 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
function arc_mapa_get_coords ( hab, tile_x , tile_y )
-- La primera habitació es la 0
@@ -176,12 +181,17 @@ function arc_mapa_get_map_coords ( x, y )
return calc_room, calc_col, calc_row
end
function arc_check_tile(x,y)
function arc_check_tile(world_x,world_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)
-- tiletype => void=0 / nonpc=1 / stair=2 /
-- switch=3 / half=4 / block=5
local hab, xx, yy = arc_mapa_get_map_coords(world_x, world_y)
local tile=mapa_get_tile(hab,xx,yy)
-- print("ARC_CT= "..hab.."> "..x..", "..y.." => "..tile)
if tile<8 then
return tiletype.half
elseif tile<15 then