-new graphics
-elalien -accents
This commit is contained in:
231
elalien.lua
Normal file
231
elalien.lua
Normal file
@@ -0,0 +1,231 @@
|
||||
elalien={hab=59,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
|
||||
end
|
||||
|
||||
function elalien.draw()
|
||||
local flip=elalien.flip
|
||||
if elalien.update==elalien.update_stairs then
|
||||
flip=(((elalien.x>>1)+(elalien.y>>1))%2)==0
|
||||
end
|
||||
sspr((elalien.frame&7)*16,(elalien.frame>>3)*16,16,16,elalien.x,elalien.y,16,16,flip)
|
||||
end
|
||||
|
||||
function elalien.hit()
|
||||
end
|
||||
|
||||
function elalien.update_normal()
|
||||
elalien.wait=elalien.wait+1
|
||||
|
||||
if elalien.wait==6 then
|
||||
elalien.wait=0
|
||||
if elalien.stairscooldown>0 then elalien.stairscooldown=elalien.stairscooldown-1 end
|
||||
elalien.step=(elalien.step+1)%4
|
||||
elalien.frame=elalien.anim[elalien.step+1]
|
||||
|
||||
local inc=12 if elalien.flip then inc=2 end
|
||||
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 then
|
||||
if elalien.flip then
|
||||
elalien.x=elalien.x-2
|
||||
else
|
||||
elalien.x=elalien.x+2
|
||||
end
|
||||
if elalien.x<-4 then
|
||||
elalien.hab=elalien.hab-1
|
||||
elalien.x=84
|
||||
end
|
||||
elseif check_tile(elalien.hab,elalien.x+inc,elalien.y+6)<tiletype.half then
|
||||
if rnd(2)==0 then
|
||||
elalien.update=elalien.update_jumping
|
||||
elalien.step=0
|
||||
else
|
||||
if elalien.flip then
|
||||
elalien.x=elalien.x-2
|
||||
else
|
||||
elalien.x=elalien.x+2
|
||||
end
|
||||
if elalien.x<-4 then
|
||||
elalien.hab=elalien.hab-1
|
||||
elalien.x=84
|
||||
end
|
||||
end
|
||||
else
|
||||
--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
|
||||
--elalien.update=elalien.update_falling
|
||||
--else
|
||||
elalien.flip=not elalien.flip
|
||||
--end
|
||||
end
|
||||
|
||||
if check_tile(elalien.hab,elalien.x+6,elalien.y+8)==tiletype.stair and elalien.stairscooldown==0 then
|
||||
if rnd(10)<3 then
|
||||
elalien.update=elalien.update_stairs
|
||||
if check_tile(elalien.hab,elalien.x+4,elalien.y+16)==tiletype.block then
|
||||
elalien.goup=true
|
||||
else
|
||||
elalien.goup=false
|
||||
end
|
||||
--elalien.goup=rnd(2)==0 and true or false
|
||||
else
|
||||
elalien.stairscooldown=50
|
||||
end
|
||||
elseif elalien.update==elalien.update_stairs then
|
||||
elalien.stairscooldown=50
|
||||
elalien.update=elalien.update_normal
|
||||
elalien.frame=8
|
||||
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)
|
||||
if option<5 then
|
||||
elalien.update=elalien.update_falling
|
||||
elseif option<8 then
|
||||
elalien.update=elalien.update_jumping
|
||||
elalien.step=0
|
||||
else
|
||||
elalien.flip=not elalien.flip
|
||||
end
|
||||
end
|
||||
|
||||
if elalien.hab==abad.hab then
|
||||
if aabb(abad,elalien) then
|
||||
if not elalien.scene_intro then
|
||||
start_scene(scenes.elalien_intro)
|
||||
elalien.scene_intro=true
|
||||
elseif not elalien.scene_object and abad.objects.gorro~=nil then
|
||||
start_scene(scenes.elalien_gorro)
|
||||
elalien.scene_object=true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
function elalien.update_jumping()
|
||||
elalien.frame=9
|
||||
elalien.wait=elalien.wait+1
|
||||
|
||||
if elalien.wait==6 then
|
||||
elalien.wait=0
|
||||
|
||||
local inc=12 if elalien.flip then inc=2 end
|
||||
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
|
||||
if elalien.flip then
|
||||
elalien.x=elalien.x-2
|
||||
else
|
||||
elalien.x=elalien.x+2
|
||||
end
|
||||
if elalien.x<-4 then
|
||||
elalien.hab=elalien.hab-1
|
||||
elalien.x=84
|
||||
end
|
||||
end
|
||||
|
||||
if elalien.step<6 then
|
||||
if elalien.y>0 then
|
||||
if check_tile(elalien.hab,elalien.x+4,elalien.y-2)~=tiletype.block then
|
||||
if (elalien.x+4)&7==0 or check_tile(elalien.hab,elalien.x+12,elalien.y-2)~=tiletype.block then
|
||||
elalien.y=elalien.y-2
|
||||
end
|
||||
end
|
||||
else
|
||||
elalien.hab=elalien.hab-10
|
||||
elalien.y=32
|
||||
end
|
||||
elseif elalien.step>6 then
|
||||
elalien.update=elalien.update_falling
|
||||
end
|
||||
elalien.step=elalien.step+1
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function elalien.update_falling()
|
||||
elalien.frame=9
|
||||
elalien.wait=elalien.wait+1
|
||||
|
||||
if elalien.wait==6 then
|
||||
elalien.wait=0
|
||||
|
||||
local inc=12 if elalien.flip then inc=2 end
|
||||
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
|
||||
if elalien.flip then
|
||||
elalien.x=elalien.x-2
|
||||
else
|
||||
elalien.x=elalien.x+2
|
||||
end
|
||||
if elalien.x<-4 then
|
||||
elalien.hab=elalien.hab-1
|
||||
elalien.x=84
|
||||
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
|
||||
return
|
||||
end
|
||||
elalien.y=elalien.y+2
|
||||
else
|
||||
elalien.hab=elalien.hab+10
|
||||
elalien.y=0
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function elalien.update_stairs()
|
||||
elalien.frame=11
|
||||
elalien.wait=elalien.wait+1
|
||||
|
||||
if elalien.wait==6 then
|
||||
elalien.wait=0
|
||||
|
||||
--if btn(KEY_RIGHT) then
|
||||
-- elalien.flip=false
|
||||
-- elalien_advance()
|
||||
--elseif btn(KEY_LEFT) then
|
||||
-- elalien.flip=true
|
||||
-- elalien_advance()
|
||||
if elalien.goup then
|
||||
if elalien.y>0 then
|
||||
if check_tile(elalien.hab,elalien.x+4,elalien.y+8)==tiletype.stair or (elalien.x+4)&7~=0 and check_tile(elalien.hab,elalien.x+12,elalien.y+8)==tiletype.stair then
|
||||
elalien.y=elalien.y-2
|
||||
else
|
||||
elalien.update=elalien.update_normal
|
||||
elalien.stairscooldown=50
|
||||
end
|
||||
else
|
||||
elalien.hab=elalien.hab-10
|
||||
elalien.y=32
|
||||
end
|
||||
else
|
||||
if elalien.y<32 then
|
||||
if check_tile(elalien.hab,elalien.x+4,elalien.y+16)==tiletype.stair or (elalien.x+4)&7~=0 and check_tile(elalien.hab,elalien.x+12,elalien.y+16)==tiletype.stair then
|
||||
elalien.y=elalien.y+2
|
||||
else
|
||||
elalien.update=elalien.update_normal
|
||||
elalien.stairscooldown=50
|
||||
end
|
||||
else
|
||||
elalien.hab=elalien.hab+10
|
||||
elalien.y=0
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
2
game.ini
2
game.ini
@@ -2,4 +2,4 @@ title=Cacaus
|
||||
width=128
|
||||
height=96
|
||||
zoom=4
|
||||
files=scenes.lua,starter.lua,score.lua,switches.lua,map.lua,mapa.lua,cacau.lua,premiere.lua,caco.lua,zombie.lua,abad.lua,main.lua
|
||||
files=scenes.lua,starter.lua,score.lua,switches.lua,map.lua,mapa.lua,cacau.lua,elalien.lua,premiere.lua,caco.lua,zombie.lua,abad.lua,main.lua
|
||||
|
||||
6
main.lua
6
main.lua
@@ -26,6 +26,8 @@ function _init()
|
||||
table.insert(actors,abad)
|
||||
premiere.init()
|
||||
table.insert(actors,premiere)
|
||||
elalien.init()
|
||||
table.insert(actors,elalien)
|
||||
z = zombie.new()
|
||||
table.insert(actors,z)
|
||||
c=caco.new(13,24,16,true)
|
||||
@@ -145,8 +147,8 @@ function update_game()
|
||||
else
|
||||
draw_hab(abad.hab,0,0)
|
||||
--text(abad.hab,1,1,2)
|
||||
draw_hab(premiere.hab,0,48)
|
||||
text("Premiere",2,49,8)
|
||||
draw_hab(elalien.hab,0,48)
|
||||
text("EL_ALIEN",2,49,8)
|
||||
|
||||
score.draw()
|
||||
setsource(tiles)
|
||||
|
||||
4
map.lua
4
map.lua
@@ -773,8 +773,8 @@ mapa={
|
||||
{
|
||||
51,52,53,51,52,256,256,52,53,51,52,17,
|
||||
256,256,256,256,256,256,69,256,256,256,256,17,
|
||||
256,256,256,256,256,69,256,106,256,256,256,17,
|
||||
256,256,256,256,17,256,256,17,256,256,78,17,
|
||||
256,256,256,256,256,69,256,256,256,256,256,17,
|
||||
256,256,256,256,256,256,256,106,256,256,78,17,
|
||||
256,256,256,256,17,118,119,17,256,95,94,17,
|
||||
51,52,53,53,51,53,52,53,51,52,51,17,
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
premiere={hab=44,x=24,y=24,flip=true,frame=11,wait=0,step=0,anim={11,12,11,13},bb={x=4,y=0,w=8,h=16},scene_intro=false,scene_object=false}
|
||||
premiere={hab=44,x=24,y=24,flip=true,frame=11,wait=0,step=0,anim={12,13,12,14},bb={x=4,y=0,w=8,h=16},scene_intro=false,scene_object=false}
|
||||
|
||||
function premiere.init()
|
||||
premiere.hit=premiere.hit
|
||||
@@ -65,7 +65,7 @@ function premiere.update_normal()
|
||||
end
|
||||
|
||||
function premiere.update_jumping()
|
||||
premiere.frame=12
|
||||
premiere.frame=13
|
||||
premiere.wait=premiere.wait+1
|
||||
|
||||
if premiere.wait==6 then
|
||||
@@ -107,7 +107,7 @@ function premiere.update_jumping()
|
||||
end
|
||||
|
||||
function premiere.update_falling()
|
||||
premiere.frame=12
|
||||
premiere.frame=13
|
||||
premiere.wait=premiere.wait+1
|
||||
|
||||
if premiere.wait==6 then
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
scenes={
|
||||
abad_inici={
|
||||
{x=4,y=0,flip=false,text={"Be, millor me fique a","buscar... com s'eixia","d'esta habitacio???"}},
|
||||
{x=4,y=0,flip=false,text={"Be, millor comence a","buscar... com s'eixia","d'esta habitació???"}},
|
||||
{x=4,y=0,flip=true,text={"Perque parles","tu soles?",""}},
|
||||
{x=4,y=0,flip=false,text={"Pa que Doc prove","com queden els","dialegs..."}}
|
||||
{x=4,y=0,flip=false,text={"Pa que Doc prove","com queden els","diàlegs..."}}
|
||||
},
|
||||
abad_corfes={
|
||||
{x=4,y=0,flip=false,text={"Osti, esta ple de","monstruacos.",""}},
|
||||
{x=4,y=0,flip=false,text={"Pos al que s'acoste","s'endura una corfa","de cacau al cap!"}}
|
||||
{x=4,y=0,flip=false,text={"Osti, està ple de","monstruacos.",""}},
|
||||
{x=4,y=0,flip=false,text={"Pos al que s'acoste","s'endurà una corfa","de cacau al cap!"}}
|
||||
}
|
||||
--premiere_intro={x=4,y=0,text={"Be, millor me fique a","buscar... com s'eixia","d'esta habitacio???"}}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user