diff --git a/data/controller.lua b/data/controller.lua index 7f6e222..32c227e 100644 --- a/data/controller.lua +++ b/data/controller.lua @@ -60,6 +60,8 @@ function controller:check(action) elseif action=="shoot" then -- result = key.down(keyShoot) or pad.down(btnShoot) result = self:key_release(keyShoot) or self:key_release(btnShoot) + elseif action=="ESC" then + result = key.press(key.ESCAPE) or pad.press(btnPause) end return result end diff --git a/data/flow.lua b/data/flow.lua index c67b48e..1068195 100644 --- a/data/flow.lua +++ b/data/flow.lua @@ -46,10 +46,10 @@ function flow:borrar(nom) end function flow:executar(nom, stacking) -print("FLOW EXEC "..nom) +-- print("FLOW EXEC "..nom) if stacking then table.insert(self.stack, self.actiu) - print(" APILAT "..self.actiu.."!") + -- print(" APILAT "..self.actiu.."!") end self.actiu=nom self.registre[self.actiu].ptr=0 @@ -82,7 +82,7 @@ end function flow:next() local ptr = self.registre[self.actiu].ptr local steps = #self.registre[self.actiu].path -print("FLOW_NEXT= "..self.actiu..", "..ptr..", "..steps) +-- print("FLOW_NEXT= "..self.actiu..", "..ptr..", "..steps) if ptr+1>steps then self:finish() else diff --git a/data/gorro.lua b/data/gorro.lua index eeab55b..563c643 100644 --- a/data/gorro.lua +++ b/data/gorro.lua @@ -1,8 +1,3 @@ -o2aX = arcade_config.org2arc_escala -cxr = arcade_config.character_per_row-1 -cxr2 = arcade_config.character_per_row_base2 -cw = arcade_config.character_width -ch = arcade_config.character_height -- posició en el gif gorro_gif_col = 6 gorro_gif_row = 2 @@ -10,11 +5,14 @@ gorro_gif_row = 2 gorro={name="gorro",hab=5,x=6,y=3,w=32,h=32,bb={x=0,y=0,w=16,h=16}} function gorro.init() - local habs={{60,5},{4,5},{34,4},{62,7},{75,4}} - local r=1+math.random(0,#habs-1) - gorro.hab=habs[r][1] + -- local habs={{60,5},{4,5},{34,4},{62,7},{75,4}} + -- local r=1+math.random(0,#habs-1) + -- gorro.hab=habs[r][1] + -- gorro.x=habs[r][2] + -- gorro.x=habs[r][2]*8 - gorro.x=habs[r][2] + gorro.hab=4 + gorro.x=5 local world_x, world_y = coords.room_to_world(gorro.hab,gorro.x,gorro.y) gorro.x=world_x @@ -24,28 +22,23 @@ function gorro.init() end function gorro.draw() - -- draw.surf(96,32,16,16,gorro.x,gorro.y,16,16) - -- local x = gorro_gif_col*cw - -- local y = gorro_gif_row*ch - -- draw.surf(x,y,cw,ch,gorro.x*o2aX,gorro.y*o2aX,cw,ch) - - local x = gorro_gif_col*cw - local y = gorro_gif_row*ch + local x = gorro_gif_col*gorro.w + local y = gorro_gif_row*gorro.h local scr_x, scr_y = viewp:screen_coords( gorro.x, gorro.y ) draw.surf(x,y,gorro.w,gorro.h,scr_x,scr_y,gorro.w,gorro.h) end function gorro.update() - -- if gorro.hab==abad.hab then - -- if aabb(abad,gorro) then - -- abad.objects.gorro=true - -- if premiere.scene_intro then - -- start_scene(scenes.gorro_trobat) - -- else - -- start_scene(scenes.gorro_trobat_nointro) - -- end - -- if abad.objects.gps~=nil then current_camera=3 end - -- remove_actor(gorro) - -- end - -- end + if gorro.hab==abad.hab then + if collision(abad,gorro) then + abad.objects.gorro=true + if premiere.scene_intro then + start_scene(scenes.gorro_trobat) + else + start_scene(scenes.gorro_trobat_nointro) + end + -- if abad.objects.gps~=nil then current_camera=3 end + remove_actor(gorro) + end + end end diff --git a/data/logo.lua b/data/logo.lua index aed0ecd..905727a 100644 --- a/data/logo.lua +++ b/data/logo.lua @@ -98,8 +98,10 @@ function logo_draw() -- Final if logo_step>=5 then + pal.subpal(15,2) draw.surf(0,0,63,10, logo_anim[1].x0,logo_anim[1].y,logo_anim[1].w,logo_anim[1].h*5); -- JAILGAMES draw.surf(0,10,55,10, 100,102,55,10); -- presenta + pal.subpal(15) end end @@ -162,7 +164,7 @@ function logo_update() -- Pausa final if logo_step==5 then logo_step = 6 - logo_wait = 75 + logo_wait = 125 end -- Final @@ -182,9 +184,9 @@ function logo_animate() logo_wait=logo_wait-1 -- Següent bucle - if logo_step==7 or logo_wait==0 or key.press(key.ESCAPE) or key.press(keyShoot) or pad.press(btnShoot) or pad.press(btnPause) then + if logo_step==7 or controller:check("ESC") or controller:check("shoot") then local modul, pas=flow:next() - print("LOGO_ANIMATE 1= "..modul..", "..pas) + -- print("LOGO_ANIMATE 1= "..modul..", "..pas) end logo_draw() diff --git a/data/premiere.lua b/data/premiere.lua index b55d05b..21e9e30 100644 --- a/data/premiere.lua +++ b/data/premiere.lua @@ -1,8 +1,4 @@ -o2aX = arcade_config.org2arc_escala -cxr = arcade_config.character_per_row-1 cxr2 = arcade_config.character_per_row_base2 -cw = arcade_config.character_width -ch = arcade_config.character_height premiere={name="premiere", hab=75, @@ -10,18 +6,18 @@ premiere={name="premiere", y=24, w=32, h=32, - flip=true, + flip=false, frame=12, wait=0, step=0, anim={12,13,12,14}, - bb={x=4,y=0,w=8,h=16}, + bb={x=0,y=0,w=32,h=32}, scene_intro=false, scene_object=false} function premiere.init() -- premiere.x=24 - premiere.x=3 + premiere.x=4 -- premiere.y=24 premiere.y=3 premiere.w=32 @@ -33,9 +29,12 @@ function premiere.init() premiere.update=premiere.update_stay premiere.scene_intro=false premiere.scene_object=false + -- local habs={75,44,20,0} local habs={75,44,20,0} premiere.hab=habs[1+math.random(0,3)] + premiere.hab=0 + local world_x, world_y = coords.room_to_world(premiere.hab,premiere.x,premiere.y) premiere.x=world_x premiere.y=world_y @@ -43,14 +42,10 @@ function premiere.init() end function premiere.draw() - -- draw.surf((premiere.frame&7)*16,(premiere.frame>>3)*16,16,16,premiere.x,premiere.y,16,16,premiere.flip) - -- draw.surf((premiere.frame&7)*cw,(premiere.frame>>cxr2)*ch,cw,ch,premiere.x*o2aX,premiere.y*o2aX,cw,ch,premiere.flip) - local scr_x, scr_y = viewp:screen_coords( premiere.x, premiere.y ) - -- draw.surf(premiere.x,premiere.y,premiere.w,premiere.h,scr_x,scr_y,premiere.w,premiere.h) - local x = (premiere.frame&7)*cw - local y = (premiere.frame>>cxr2)*ch - draw.surf(x,y,cw,ch,scr_x,scr_y,premiere.w,premiere.h,premiere.flip) + local x = (premiere.frame&7)*premiere.w + local y = (premiere.frame>>cxr2)*premiere.h + draw.surf(x,y,premiere.w,premiere.h,scr_x,scr_y,premiere.w,premiere.h,premiere.flip) end function premiere.hit() @@ -59,11 +54,32 @@ end function premiere.update_stay() premiere.wait=premiere.wait+1 - if premiere.wait==6 then + if premiere.wait==96 then premiere.wait=0 premiere.step=(premiere.step+1)%4 premiere.frame=premiere.anim[premiere.step+1] end + + if premiere.hab==abad.hab then + if collision(abad,premiere) then + if not premiere.scene_intro then + if abad.objects.gorro~=nil then + start_scene(scenes.premiere_intro_gorro) + premiere.scene_object=true + abad.objects.clau_premiere=true + abad.objects.gorro=nil + else + start_scene(scenes.premiere_intro) + end + premiere.scene_intro=true + elseif not premiere.scene_object and abad.objects.gorro~=nil then + start_scene(scenes.premiere_gorro) + premiere.scene_object=true + abad.objects.clau_premiere=true + abad.objects.gorro=nil + end + end + end end function premiere.update_normal() diff --git a/data/tiles.gif b/data/tiles.gif index d27e22d..70f3845 100644 Binary files a/data/tiles.gif and b/data/tiles.gif differ diff --git a/data/title.lua b/data/title.lua index 769c897..d826cae 100644 --- a/data/title.lua +++ b/data/title.lua @@ -122,6 +122,7 @@ function title_show() end function title_end() + music.stop() if menu_sel==0 then -- game_exit() -- game_init()