diff --git a/data/abad.lua b/data/abad.lua index f66b7cd..1ddf616 100644 --- a/data/abad.lua +++ b/data/abad.lua @@ -356,7 +356,7 @@ function abad_state_fire() end end - if abad.save_update~=nil then abad_advance() end + if abad.save_update~=nil and abad.save_update~=abad_state_normal then abad_advance() end end function abad_state_walking() diff --git a/data/audio.lua b/data/audio.lua index a0a3875..8abbf55 100644 --- a/data/audio.lua +++ b/data/audio.lua @@ -19,3 +19,4 @@ audio_text_abad="snd_txta.wav" audio_text_premiere="snd_txtp.wav" audio_text_elalien="snd_txte.wav" audio_text_batman="snd_txtb.wav" +audio_text_imp="snd_txtb.wav" diff --git a/data/fireball.lua b/data/fireball.lua new file mode 100644 index 0000000..7500a63 --- /dev/null +++ b/data/fireball.lua @@ -0,0 +1,52 @@ +local arcade_config = require("arcade_config") +o2aX = arcade_config.org2arc_escala + +fireball={hab=-1,x=0,y=0,wait=0,flip=false,bb={x=0,y=0,w=4,h=4}} + +function fireball.init(_hab,_x,_y,_flip) + if fireball.hab ~= -1 then return end + fireball.hab=_hab + fireball.x=_x + fireball.y=_y + fireball.flip=_flip +end + +function fireball.draw() + draw.circf(fireball.x*o2aX,fireball.y*o2aX,3*o2aX,16) + draw.circf(fireball.x*o2aX,fireball.y*o2aX,2*o2aX,3) + draw.circf(fireball.x*o2aX,fireball.y*o2aX,1*o2aX,8) +end + +function fireball.update() + if fireball.hab == -1 then return end + fireball.wait=fireball.wait+1 + + if fireball.wait==3 then + fireball.wait=0 + + if fireball.x>96 then + fireball.hab=-1 + return + elseif check_tile(fireball.hab,fireball.x,fireball.y)=tiletype.half then + -- imp.enabled=true + -- imp.flip=true + -- imp.x=92 + -- else + -- imp.reset() + -- end + -- else + -- if check_tile(imp.hab,0,38)=tiletype.half then + -- imp.enabled=true + -- imp.flip=false + -- imp.x=-12 + -- else + -- imp.reset() + -- end + -- end + imp.hab=55 + local world_x, world_y = coords.room_to_world(55,4,3) + imp.x=world_x + imp.y=world_y + imp.flip = true +end + +function imp.draw() + -- if imp.enabled then + -- -- draw.surf((imp.frame&7)*16,(imp.frame>>3)*16,16,16,imp.x,imp.y,16,16,imp.flip) + -- draw.surf((imp.frame&7)*cw,(imp.frame>>cxr2)*ch,cw,ch,imp.x*o2aX,imp.y*o2aX,cw,ch,imp.flip) + -- end + local scr_x, scr_y = viewp:screen_coords( imp.x, imp.y ) + draw.surf((imp.frame&7)*imp.w, (imp.frame>>cxr2)*imp.h, imp.w, imp.h, scr_x, scr_y, imp.w, imp.h, imp.flip) +end + +function imp.hit() +end + +function imp.update() + -- imp.wait=imp.wait+1 + -- + -- if imp.wait==6 then + -- imp.wait=0 + -- if not imp.enabled then + -- imp.counter=imp.counter-1 + -- local r = math.random(0,imp.counter-1) + -- --print(r) + -- if imp.counter==1 or r==1 then + -- imp.init() + -- end + -- return + -- end + -- + -- imp.step=(imp.step+1)%4 + -- imp.frame=imp.anim[imp.step+1] + -- + -- if imp.flip then + -- imp.x=imp.x-2 + -- if imp.x==78 then + -- fireball.init(imp.hab,imp.x+8,imp.y+4,imp.flip) + -- sound.play(audio_hit) + -- imp.flip=not imp.flip + -- elseif imp.x==-12 then + -- imp.reset() + -- end + -- else + -- imp.x=imp.x+2 + -- if imp.x==4 then + -- fireball.init(imp.hab,imp.x+8,imp.y+4,imp.flip) + -- sound.play(audio_hit) + -- imp.flip=not imp.flip + -- elseif imp.x==92 then + -- imp.reset() + -- end + -- end + -- + -- end +end + diff --git a/data/intro.lua b/data/intro.lua index c6aa6b9..bdc8700 100644 --- a/data/intro.lua +++ b/data/intro.lua @@ -1,6 +1,7 @@ local abad={x=0,y=0,w=32,h=32,dx=88,dy=48,dw=32,dh=32} local batman={x=0,y=96,w=32,h=32,dx=164,dy=48,dw=32,dh=32} local cacaus={x=224,y=176,w=32,h=16,dx=152,dy=64,dw=32,dh=16} +local cacaus_trans={x=192,y=176,w=16,h=8,dx=65,dy=56,dw=16,dh=8} local marc={x=30,y=6,w=198,h=102,color=2} local pas_porta={x=146,y=48,w=14,h=32,color=16} local scene_x_offset = 32 @@ -25,6 +26,8 @@ function draw_item_intro( name, flip ) draw.surf(batman.x, batman.y, batman.w, batman.h, batman.dx, batman.dy, batman.dw, batman.dh, flip) elseif (name == "cacaus" ) then draw.surf(cacaus.x, cacaus.y, cacaus.w, cacaus.h, cacaus.dx, cacaus.dy, cacaus.dw, cacaus.dh, flip) + elseif (name == "cacaus trans" ) then + draw.surf(cacaus_trans.x, cacaus_trans.y, cacaus_trans.w, cacaus_trans.h, cacaus_trans.dx, cacaus_trans.dy, cacaus_trans.dw, cacaus_trans.dh, flip) elseif (name == "marc" ) then draw.rect(marc.x, marc.y, marc.w, marc.h, marc.color) elseif (name == "pas porta" ) then @@ -82,7 +85,8 @@ function intro_update() -- STEP 2 elseif intro_step==2 then draw_escenari() - draw_item_intro("abad", false) + draw_item_intro("abad", true) + draw_item_intro("cacaus trans", false) view.origin(0,0) intro_step=intro_step+1 -- STEP 3 diff --git a/data/main.lua b/data/main.lua index 93b6037..a6dd8a6 100644 --- a/data/main.lua +++ b/data/main.lua @@ -61,6 +61,7 @@ function audio_init() audio_text_premiere = sound.load(audio_text_premiere) audio_text_elalien = sound.load(audio_text_elalien) audio_text_batman = sound.load(audio_text_batman) + audio_text_imp = sound.load(audio_text_imp) audio_abad_jump = sound.load(audio_abad_jump) audio_abad_fall = sound.load(audio_abad_fall) audio_abad_hit = sound.load(audio_abad_hit) @@ -86,7 +87,7 @@ function mini.init() surf.target(0) surf.cls(16) - flow:executar("game") + flow:executar("intro") end function mini.update() diff --git a/data/scenes.lua b/data/scenes.lua index f9b2ac5..cbe4be7 100644 --- a/data/scenes.lua +++ b/data/scenes.lua @@ -21,11 +21,11 @@ avatar_imp_y = 96 scenes={ lluita_imp= { {x=avatar_abad_x,y=avatar_abad_y,flip=false,audio="abad",text={"Eh!?","...","Tu qui eres?"},die=20}, - {x=avatar_imp_x, y=avatar_imp_y,flip=true,audio="abad",text={"","Aaaarrrrgghhh",""},die=20,musica=audio_song_imp}, + {x=avatar_imp_x, y=avatar_imp_y,flip=true,audio="imp",text={"","Aaaarrrrgghhh",""},die=20,musica=audio_song_imp}, {x=avatar_abad_x,y=avatar_abad_y,flip=false,audio="abad",text={"Who are you?","Comment tu t'appel?","Quod nomen tibi est?"},die=20}, - {x=avatar_imp_x, y=avatar_imp_y,flip=true,audio="abad",text={"","Grwuuuunnnn",""},die=20}, + {x=avatar_imp_x, y=avatar_imp_y,flip=true,audio="imp",text={"","Grwuuuunnnn",""},die=20}, {x=avatar_abad_x,y=avatar_abad_y,flip=false,audio="abad",text={"Eeeerrrrggggg","Prruuuuuuummm","Uooooorrrr"},die=20}, - {x=avatar_imp_x, y=avatar_imp_y,flip=true,audio="abad",text={"","GROOOOAAAARRR",""},die=20}, + {x=avatar_imp_x, y=avatar_imp_y,flip=true,audio="imp",text={"","GROOOOAAAARRR",""},die=20}, {x=avatar_abad_x,y=avatar_abad_y,flip=false,audio="abad",text={"MERDA!!","S'HA ENFADAT!!!","CACAUS A MI!!!!"},die=20}, }, llibre_trobat={ @@ -193,6 +193,8 @@ function playtext(snd) sound.play(audio_text_premiere) elseif snd=="elalien" then sound.play(audio_text_elalien) + elseif snd=="imp" then + sound.play(audio_text_imp) end end diff --git a/data/snd_txti.wav b/data/snd_txti.wav new file mode 100644 index 0000000..d519eb9 Binary files /dev/null and b/data/snd_txti.wav differ diff --git a/data/tiles.gif b/data/tiles.gif index df748db..6514bfb 100644 Binary files a/data/tiles.gif and b/data/tiles.gif differ