- Improved Batman AI

This commit is contained in:
2022-10-27 18:50:52 +02:00
parent a710317c0a
commit 75c38046d7

View File

@@ -1,4 +1,4 @@
batman={hab=5,x=24,y=24,flip=true,goup=true,frame=8,stairscooldown=0,stepscooldown=0,wait=0,step=0,anim={24,25,24,26},bb={x=4,y=0,w=8,h=16},scene_intro=false,scene_object=false}
batman={hab=5,x=24,y=24,flip=true,goup=true,frame=8,stairscooldown=0,stepscooldown=0,stepsremember=0,wait=0,step=0,anim={24,25,24,26},bb={x=4,y=0,w=8,h=16},scene_intro=false,scene_object=false}
function batman.init()
batman.hit=batman.hit
@@ -53,12 +53,11 @@ function batman.update_normal()
elseif check_tile(batman.hab,batman.x+inc,batman.y+6)<tiletype.half then
local r=rnd(2)
if check_tile(batman.hab,batman.x+inc,batman.y+14)==tiletype.block then r=0 end
if batman.stepscooldown>0 and check_tile(batman.hab,batman.x+inc,batman.y+14)==tiletype.half then r=1 end
if batman.stepscooldown>0 and check_tile(batman.hab,batman.x+inc,batman.y+14)==tiletype.half then r=batman.stepsremember end
if r==0 then
batman.update=batman.update_jumping
batman.step=0
else
batman.stepscooldown=4
if batman.flip then
batman.x=batman.x-2
else
@@ -69,6 +68,10 @@ function batman.update_normal()
batman.x=84
end
end
if batman.stepscooldown==0 then
batman.stepscooldown=30
batman.stepsremember=r
end
else
--if check_tile(batman.hab,batman.x+4,batman.y+16)==tiletype.void and ((batman.x+4)&7==0 or check_tile(batman.hab,batman.x+12,batman.y+16)==tiletype.void) then
--batman.update=batman.update_falling