[FIX] L'Abad ja s'enganxa be a les escales
This commit is contained in:
+15
-8
@@ -311,6 +311,7 @@ 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 result = false
|
||||||
|
|
||||||
-- local x1_check = abad.x+abad.bb.x+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 x2_check = abad.x+abad.bb.x+abad.bb.w+next_x
|
||||||
@@ -332,10 +333,12 @@ function abad_in_stairs(next_x, 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(x1_check, y2_check)==tiletype.stair
|
arc_check_tile(x1_check, y2_check)==tiletype.stair
|
||||||
then
|
then
|
||||||
return true
|
result = true
|
||||||
end
|
end
|
||||||
|
|
||||||
return false
|
if result then print("IN STAIRS "..next_x.." "..next_y) else print("-") end
|
||||||
|
|
||||||
|
return result
|
||||||
end
|
end
|
||||||
|
|
||||||
function abad_in_floor(next_x, next_y)
|
function abad_in_floor(next_x, next_y)
|
||||||
@@ -394,6 +397,14 @@ function abad_advance()
|
|||||||
abad.hab = hab
|
abad.hab = hab
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function abad_move_down()
|
||||||
|
if abad_in_stairs() then
|
||||||
|
abad.update=abad_state_stairs
|
||||||
|
else
|
||||||
|
abad.update=abad_state_crouch
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- Controlador principal de l'abad
|
-- Controlador principal de l'abad
|
||||||
function abad_state_normal()
|
function abad_state_normal()
|
||||||
abad.frame=0
|
abad.frame=0
|
||||||
@@ -423,11 +434,7 @@ function abad_state_normal()
|
|||||||
if controller:check("up") and abad_in_stairs() then
|
if controller:check("up") and abad_in_stairs() then
|
||||||
abad.update=abad_state_stairs
|
abad.update=abad_state_stairs
|
||||||
elseif controller:check("down") then
|
elseif controller:check("down") then
|
||||||
if abad_in_stairs() then
|
abad_move_down()
|
||||||
abad.update=abad_state_stairs
|
|
||||||
else
|
|
||||||
abad.update=abad_state_crouch
|
|
||||||
end
|
|
||||||
elseif controller:check("right") then
|
elseif controller:check("right") then
|
||||||
abad.update=abad_state_walking
|
abad.update=abad_state_walking
|
||||||
abad.flip=false
|
abad.flip=false
|
||||||
@@ -512,7 +519,7 @@ function abad_state_walking()
|
|||||||
abad_do_jump(true); -- jumping forward
|
abad_do_jump(true); -- jumping forward
|
||||||
return
|
return
|
||||||
elseif controller:check("down") then
|
elseif controller:check("down") then
|
||||||
abad.update=abad_state_crouch
|
abad_move_down()
|
||||||
elseif controller:check("shoot") then
|
elseif controller:check("shoot") then
|
||||||
abad_shot_cacau()
|
abad_shot_cacau()
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user