- [WIP] Batman AI
- [WIP] EL_ALIEN AI - Multi-camera - Random starting places
This commit is contained in:
31
elalien.lua
31
elalien.lua
@@ -1,9 +1,11 @@
|
||||
elalien={hab=38,x=24,y=24,flip=true,goup=true,frame=8,stairscooldown=0,wait=0,step=0,anim={8,9,8,10},bb={x=4,y=0,w=8,h=16},scene_intro=false,scene_object=false}
|
||||
elalien={hab=66,x=24,y=24,flip=true,goup=true,frame=8,stairscooldown=0,wait=0,step=0,anim={8,9,8,10},bb={x=4,y=0,w=8,h=16},scene_intro=false,scene_object=false}
|
||||
|
||||
function elalien.init()
|
||||
elalien.hit=elalien.hit
|
||||
elalien.update=elalien.update_normal
|
||||
elalien.draw=elalien.draw
|
||||
local habs={66,56,59,53}
|
||||
premiere.hab=habs[1+rnd(4)]
|
||||
end
|
||||
|
||||
function elalien.draw()
|
||||
@@ -31,12 +33,12 @@ function elalien.update_normal()
|
||||
elalien.hab=elalien.hab+1
|
||||
elalien.x=-4
|
||||
elseif check_tile(elalien.hab,elalien.x+inc,elalien.y+14)==tiletype.nonpc then
|
||||
if rnd(10)<8 then
|
||||
--if rnd(10)<8 then
|
||||
elalien.update=elalien.update_jumping
|
||||
elalien.step=0
|
||||
else
|
||||
elalien.flip=not elalien.flip
|
||||
end
|
||||
--else
|
||||
-- elalien.flip=not elalien.flip
|
||||
--end
|
||||
elseif check_tile(elalien.hab,elalien.x+inc,elalien.y+14)<tiletype.half then
|
||||
if elalien.flip then
|
||||
elalien.x=elalien.x-2
|
||||
@@ -75,7 +77,7 @@ function elalien.update_normal()
|
||||
if elalien.stairscooldown==0 and
|
||||
check_tile(elalien.hab,elalien.x+6,elalien.y+8)==tiletype.stair and
|
||||
check_tile(elalien.hab,elalien.x+14,elalien.y+8)==tiletype.stair then
|
||||
if rnd(10)<6 then
|
||||
if rnd(10)<8 then
|
||||
elalien.update=elalien.update_stairs
|
||||
if check_tile(elalien.hab,elalien.x+4,elalien.y+16)==tiletype.block then
|
||||
elalien.goup=true
|
||||
@@ -93,16 +95,16 @@ function elalien.update_normal()
|
||||
end
|
||||
|
||||
if check_tile(elalien.hab,elalien.x+4,elalien.y+16)==tiletype.void and ((elalien.x+4)&7==0 or check_tile(elalien.hab,elalien.x+12,elalien.y+16)==tiletype.void) then
|
||||
local option=rnd(10)
|
||||
local option=rnd(2)
|
||||
if elalien.stairscooldown>0 then option=0 end
|
||||
if option<5 then
|
||||
if option==0 then
|
||||
elalien.update=elalien.update_falling
|
||||
elseif option<8 then
|
||||
else
|
||||
elalien.update=elalien.update_jumping
|
||||
elalien.step=0
|
||||
elalien.wait=0
|
||||
else
|
||||
elalien.flip=not elalien.flip
|
||||
--else
|
||||
-- elalien.flip=not elalien.flip
|
||||
end
|
||||
end
|
||||
|
||||
@@ -174,7 +176,7 @@ function elalien.update_falling()
|
||||
if not elalien.flip and elalien.x==84 then
|
||||
elalien.hab=elalien.hab+1
|
||||
elalien.x=-4
|
||||
elseif check_tile(elalien.hab,elalien.x+inc,elalien.y+14)<tiletype.half and check_tile(elalien.hab,elalien.x+inc,elalien.y+16)~=tiletype.void then
|
||||
elseif check_tile(elalien.hab,elalien.x+inc,elalien.y+14)<tiletype.half then
|
||||
if elalien.flip then
|
||||
elalien.x=elalien.x-2
|
||||
else
|
||||
@@ -186,9 +188,6 @@ function elalien.update_falling()
|
||||
end
|
||||
end
|
||||
|
||||
local xx=flr((elalien.x+4)/8)
|
||||
local yy=flr((elalien.y+16)/8)
|
||||
|
||||
if elalien.y<32 then
|
||||
if (elalien.y+16)&7==0 and (check_tile(elalien.hab,elalien.x+4,elalien.y+16)>=tiletype.half or ((elalien.x+4)&7~=0 and check_tile(elalien.hab,elalien.x+12,elalien.y+16)>=tiletype.half)) then
|
||||
elalien.update=elalien.update_normal
|
||||
@@ -221,6 +220,7 @@ function elalien.update_stairs()
|
||||
elalien.y=elalien.y-2
|
||||
else
|
||||
elalien.update=elalien.update_normal
|
||||
if rnd(3)>0 then elalien.flip=not elalien.flip end
|
||||
elalien.stairscooldown=50
|
||||
end
|
||||
else
|
||||
@@ -233,6 +233,7 @@ function elalien.update_stairs()
|
||||
elalien.y=elalien.y+2
|
||||
else
|
||||
elalien.update=elalien.update_normal
|
||||
if rnd(3)>0 then elalien.flip=not elalien.flip end
|
||||
elalien.stairscooldown=50
|
||||
end
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user