[FIX] Canviat el mode de detecció de les escales

This commit is contained in:
2026-05-03 20:38:00 +02:00
parent 7f0f065e8b
commit 61bf843799

View File

@@ -128,7 +128,7 @@ function abad:draw()
abad.respawning=abad.respawning-1 abad.respawning=abad.respawning-1
end end
-- draw.rect(x+abad.bb.x,y+abad.bb.y,abad.bb.w,abad.bb.h,3) draw.rect(x+abad.bb.x,y+abad.bb.y,abad.bb.w,abad.bb.h,3)
end end
function abad_make_safe( force ) function abad_make_safe( force )
@@ -311,15 +311,26 @@ end
function abad_in_stairs(next_x, next_y) function abad_in_stairs(next_x, next_y)
next_x = next_x or 0 next_x = next_x or 0
next_y = next_y or 0 next_y = next_y or 0
local x1_check = abad.x+abad.bb.x+next_x
local x2_check = abad.x+abad.bb.x+abad.bb.w+next_x -- local x1_check = abad.x+abad.bb.x+next_x
-- local x2_check = abad.x+abad.bb.x+abad.bb.w+next_x
-- local y1_check = abad.y+next_y
-- local y2_check = abad.y+abad.bb.h+next_y
--
-- if arc_check_tile(x1_check, y1_check)==tiletype.stair or
-- arc_check_tile(x2_check, y1_check)==tiletype.stair or
-- arc_check_tile(x1_check, y2_check)==tiletype.stair or
-- arc_check_tile(x2_check, y2_check)==tiletype.stair
-- then
-- return true
-- end
local x1_check = abad.x+(abad.w/2)+next_x
local y1_check = abad.y+next_y local y1_check = abad.y+next_y
local y2_check = abad.y+abad.bb.h+next_y local y2_check = abad.y+abad.bb.h+next_y
if arc_check_tile(x1_check, y1_check)==tiletype.stair or if arc_check_tile(x1_check, y1_check)==tiletype.stair or
arc_check_tile(x2_check, y1_check)==tiletype.stair or arc_check_tile(x1_check, y2_check)==tiletype.stair
arc_check_tile(x1_check, y2_check)==tiletype.stair or
arc_check_tile(x2_check, y2_check)==tiletype.stair
then then
return true return true
end end
@@ -344,14 +355,17 @@ function abad_advance()
local step_length=abad.step_length; --lo que avança l'abad cada pas local step_length=abad.step_length; --lo que avança l'abad cada pas
local limit=tiletype.block local limit=tiletype.block
if abad.update~=abad_state_walking then limit=tiletype.half end if abad.update~=abad_state_walking then
limit=tiletype.half
end
local x_check = abad.x+abad.bb.x+abad.bb.w+step_length local x_check = abad.x+abad.bb.x+abad.bb.w+step_length
if abad.flip then if abad.flip then
step_length = -step_length step_length = -step_length
x_check = abad.x+abad.bb.x+step_length x_check = abad.x+abad.bb.x+step_length
end end
local y_check = abad.y+abad.bb.h-4 -- local y_check = abad.y+abad.bb.h-4
local y_check = abad.y+abad.bb.h-1
if arc_check_tile(x_check, y_check)<limit then if arc_check_tile(x_check, y_check)<limit then
abad.x=abad.x+step_length abad.x=abad.x+step_length