[NEW] Elalien en marxa

This commit is contained in:
2026-04-30 22:55:02 +02:00
parent 8b758af0e7
commit cb525845ac
3 changed files with 85 additions and 25 deletions

View File

@@ -13,6 +13,7 @@ elalien={name="elalien",
flip=true,
goup=true,
frame=8,
parpadeig=false,
stairscooldown=0,
wait=0,
step=0,
@@ -23,7 +24,7 @@ elalien={name="elalien",
function elalien.init()
-- elalien.x=24
elalien.x=3
elalien.x=9
-- elalien.y=24
elalien.y=3
elalien.w=32
@@ -37,7 +38,8 @@ function elalien.init()
elalien.scene_intro=false
elalien.scene_object=false
local habs={66,56,59,53}
elalien.hab=habs[1+math.random(0,3)]
-- elalien.hab=habs[1+math.random(0,3)]
elalien.hab=56
local world_x, world_y = coords.room_to_world(elalien.hab,elalien.x,elalien.y)
elalien.x=world_x
@@ -49,25 +51,83 @@ function elalien.draw()
if elalien.update==elalien.update_stairs then
flip=(((elalien.x>>1)+(elalien.y>>1))%2)==0
end
-- draw.surf((elalien.frame&7)*cw,(elalien.frame>>cxr2)*ch,cw,ch,elalien.x*o2aX,elalien.y*o2aX,cw,ch,flip)
local xoff0 = 18
local xoff1 = 19
local xoff2 = 20
local xoff3 = 21
-- draw.surf((elalien.frame&7)*cw,(elalien.frame>>cxr2)*ch,cw,ch,elalien.x*o2aX,elalien.y*o2aX,cw,ch,flip)
local scr_x, scr_y = viewp:screen_coords( elalien.x, elalien.y )
local x = (elalien.frame&7)*cw
local y = (elalien.frame>>cxr2)*ch
draw.surf(x,y,cw,ch,scr_x,scr_y,elalien.w,elalien.h,flip)
if elalien.update == elalien.update_stay then
draw.surf(0,32,elalien.w,elalien.h,scr_x,scr_y,elalien.w,elalien.h,flip)
if elalien.parpadeig then
if elalien.flip then
xoff0 = 13
xoff1 = 12
xoff2 = 11
xoff3 = 10
end
if elalien.step==0 then
draw.line(scr_x+xoff0, scr_y+6, scr_x+xoff0, scr_y+11, 11)
surf.pixel(scr_x+xoff1, scr_y+11, 11)
surf.pixel(scr_x+xoff1, scr_y+7, 11)
elseif elalien.step<3 then
draw.line(scr_x+xoff0, scr_y+6, scr_x+xoff0, scr_y+11, 11)
draw.line(scr_x+xoff1, scr_y+7, scr_x+xoff1, scr_y+11, 11)
draw.line(scr_x+xoff2, scr_y+8, scr_x+xoff2, scr_y+11, 11)
draw.line(scr_x+xoff3, scr_y+8, scr_x+xoff3, scr_y+11, 11)
elseif elalien.step==3 then
draw.line(scr_x+xoff0, scr_y+6, scr_x+xoff0, scr_y+11, 11)
draw.line(scr_x+xoff1, scr_y+7, scr_x+xoff1, scr_y+11, 11)
draw.line(scr_x+xoff2, scr_y+8, scr_x+xoff2, scr_y+11, 11)
draw.line(scr_x+xoff3, scr_y+8, scr_x+xoff3, scr_y+11, 11)
elalien.parpadeig = false
end
end
else
local x = (elalien.frame&7)*cw
local y = (elalien.frame>>cxr2)*ch
draw.surf(x,y,cw,ch,scr_x,scr_y,elalien.w,elalien.h,flip)
end
end
function elalien.hit()
end
function elalien.update_stay()
elalien.wait=elalien.wait+1
if elalien.wait==6 then
if elalien.wait==18 then
elalien.wait=0
elalien.step=(elalien.step+1)%4
elalien.frame=elalien.anim[elalien.step+1]
if elalien.step==0 and not elalien.parpadeig then
if math.random(5)==5 then elalien.parpadeig = true end
end
-- elalien.frame=elalien.anim[elalien.step+1]
end
if elalien.hab==abad.hab then
if collision(abad,elalien) then
if not elalien.scene_intro then
if abad.objects.peu~=nil then
start_scene(scenes.elalien_intro_peu)
elalien.scene_object=true
abad.objects.clau_elalien=true
abad.objects.peu=nil
else
start_scene(scenes.elalien_intro)
end
elalien.scene_intro=true
elseif not elalien.scene_object and abad.objects.peu~=nil then
start_scene(scenes.elalien_peu)
elalien.scene_object=true
abad.objects.clau_elalien=true
abad.objects.peu=nil
end
end
end
end
function elalien.update_normal()

View File

@@ -412,24 +412,24 @@ function special_keys()
boss._pause = not boss._pause
end
if key.press(key.N1) then
-- -- abad prev room
-- local hab = abad.hab-1
-- if hab<0 then hab=0 end
-- local hab_x = 4
-- local hab_y = 3
-- local abad_x, abad_y = coords.room_to_world ( hab, hab_x, hab_y)
-- abad:move(abad_x, abad_y)
-- local scr_ax, scr_ay = viewp:screen_coords(abad_x, abad_y)
-- abad prev room
local hab = abad.hab-1
if hab<0 then hab=0 end
local hab_x = 4
local hab_y = 3
local abad_x, abad_y = coords.room_to_world ( hab, hab_x, hab_y)
abad:move(abad_x, abad_y)
local scr_ax, scr_ay = viewp:screen_coords(abad_x, abad_y)
end
if key.press(key.N2) then
-- -- abad next room
-- local hab = abad.hab+1
-- if hab<0 then hab=0 end
-- local hab_x = 4
-- local hab_y = 3
-- local abad_x, abad_y = coords.room_to_world ( hab, hab_x, hab_y)
-- abad:move(abad_x, abad_y)
-- local scr_ax, scr_ay = viewp:screen_coords(abad_x, abad_y)
-- abad next room
local hab = abad.hab+1
if hab<0 then hab=0 end
local hab_x = 4
local hab_y = 3
local abad_x, abad_y = coords.room_to_world ( hab, hab_x, hab_y)
abad:move(abad_x, abad_y)
local scr_ax, scr_ay = viewp:screen_coords(abad_x, abad_y)
end
if key.press(key.N8) then
-- local abad_x, abad_y = coords.room_to_world ( 31, 8, 3 )

View File

@@ -140,7 +140,7 @@ function stages.stage1_init()
zombie2, abad, 150, "Aaaaaargh... per ell!", 250)
local abad_x, abad_y = coords.room_to_world ( 10, 4, 3 )
-- local abad_x, abad_y = coords.room_to_world ( 54, 8, 3 )
local abad_x, abad_y = coords.room_to_world ( 56, 7, 3 )
abad:move(abad_x, abad_y)
abad_make_safe( true )