- [NEW] Música per a l'imp
- [NEW] Escena amb l'imp - [FIX] scenes.lua - La música pot arrancar en qualsevol escena
This commit is contained in:
@@ -75,6 +75,7 @@ end
|
||||
|
||||
function abad:draw()
|
||||
local flip = abad.flip
|
||||
local x, y = viewp:screen_coords(self.x, self.y)
|
||||
if abad.update==abad_state_stairs then
|
||||
flip=abad.stairs_flip
|
||||
-- flip=(((abad.x>>1)+(abad.y>>1))%2)==0
|
||||
@@ -84,13 +85,14 @@ function abad:draw()
|
||||
msg_print(0,35,msg,true)
|
||||
end
|
||||
if (abad.respawning==0) or (math.floor(abad.respawning/15)%2==0) then
|
||||
local x, y = viewp:screen_coords(self.x, self.y)
|
||||
draw.surf(abad.frame*cw,0,cw,ch,x,y,cw,ch,flip)
|
||||
draw.surf(abad.frame*abad.w,0,abad.w,abad.h,x,y,abad.w,abad.h,flip)
|
||||
end
|
||||
|
||||
if abad.respawning > 0 then
|
||||
abad.respawning=abad.respawning-1
|
||||
end
|
||||
|
||||
draw.rect(x+abad.bb.x,y+abad.bb.y,abad.bb.w,abad.bb.h,3)
|
||||
end
|
||||
|
||||
function abad_make_safe( force )
|
||||
@@ -105,7 +107,7 @@ end
|
||||
|
||||
|
||||
function abad_hurt(howmuch)
|
||||
print(abad.hurting.." / "..abad.respawning)
|
||||
howmuch = 0
|
||||
if abad.hurting == 0 and abad.respawning==0 then
|
||||
sound.play(audio_abad_hit)
|
||||
abad.energia=abad.energia-howmuch
|
||||
|
||||
@@ -4,6 +4,7 @@ audio_song_premiere="mus_prem.ogg"
|
||||
audio_song_elalien="mus_alie.ogg"
|
||||
audio_life_lost="mus_life.ogg"
|
||||
audio_game_over="mus_over.ogg"
|
||||
audio_song_imp="mus_imp.ogg"
|
||||
audio_final=audio_main_song
|
||||
|
||||
audio_abad_jump="snd_ajmp.wav"
|
||||
|
||||
@@ -170,6 +170,7 @@ function game_init(menu)
|
||||
|
||||
table.insert( actors, trigger.new(19,32,32,triggers.escena_habitacio_batman,"habitacio batman"))
|
||||
--
|
||||
table.insert( actors, trigger.new(55,1,3,triggers.escena_lluita_imp,"lluita imp"))
|
||||
-- table.insert(actors,trigger.new(14,40,32,triggers.teleport_a))
|
||||
-- table.insert(actors,trigger.new(67,8,32,triggers.teleport_b))
|
||||
-- table.insert(actors,trigger.new(29,40,32,triggers.teleport_c))
|
||||
@@ -178,6 +179,7 @@ function game_init(menu)
|
||||
score.create()
|
||||
|
||||
local abad_x, abad_y = coords.room_to_world ( 10, 4, 3 )
|
||||
-- local abad_x, abad_y = coords.room_to_world ( 54, 8, 3 )
|
||||
abad:move(abad_x, abad_y)
|
||||
abad_make_safe( true )
|
||||
|
||||
@@ -286,12 +288,13 @@ function update_game()
|
||||
|
||||
score.draw()
|
||||
|
||||
-- viewp:print()
|
||||
-- msg_print(0,14,"ABAD= "..abad.x..", "..abad.y, true)
|
||||
-- msg_print(0,21,"VIEW= "..vp_x..", "..vp_y, true)
|
||||
-- local hab, xx, yy = coords.world_to_tile(abad.x, abad.y)
|
||||
-- msg_print(0,28,hab.." ( "..xx..", "..yy.." )", true)
|
||||
-- msg_print(0,35,hab.." ( "..xx..", "..yy.." )", true)
|
||||
font.current(font_default)
|
||||
viewp:print()
|
||||
msg_print(0,14,"ABAD= "..abad.x..", "..abad.y, true)
|
||||
msg_print(0,21,"VIEW= "..vp_x..", "..vp_y, true)
|
||||
local hab, xx, yy = coords.world_to_tile(abad.x, abad.y)
|
||||
msg_print(0,28,hab.." ( "..xx..", "..yy.." )", true)
|
||||
msg_print(0,35,hab.." ( "..xx..", "..yy.." )", true)
|
||||
-- msg_print(0,42," JH= "..abad.jump_height,true)
|
||||
|
||||
-- view_coord(abad.x+8, abad.y+0, 16, 32, 6)
|
||||
@@ -330,6 +333,82 @@ function update_game()
|
||||
-- end
|
||||
-- msg_print(abad.x, abad.y-8,msg)
|
||||
-- end
|
||||
font.current(font_sf)
|
||||
end
|
||||
|
||||
|
||||
|
||||
function pause()
|
||||
print("pause()")
|
||||
-- surf.source(0)
|
||||
-- surf.target(back)
|
||||
-- draw.surf(0,0,128,96,0,0)
|
||||
-- surf.target(0)
|
||||
-- surf.source(tiles)
|
||||
-- pausa_option=1
|
||||
-- pause_old_update=game_update
|
||||
-- game_update=update_pause
|
||||
end
|
||||
|
||||
function update_pause()
|
||||
draw.rectf(16,16,97,65,16)
|
||||
draw.rect(16,16,97,65,15)
|
||||
draw.text("PAUSA",54,20,15)
|
||||
|
||||
menu_count=menu_count+1
|
||||
local parpadeig=false
|
||||
if menu_count>=20 then
|
||||
parpadeig=true
|
||||
if menu_count>40 then menu_count=0 end
|
||||
end
|
||||
draw.rect(28,33+(10*(pausa_option-1)),73,9,14)
|
||||
if (not parpadeig) then draw.rect(28,33+(10*(pausa_option-1)),73,9,13) end
|
||||
|
||||
--draw.rect(28,33+(10*(pausa_option-1)),73,9,13)
|
||||
|
||||
draw.text("CONTINUAR",30,35,14)
|
||||
draw.text("MUSICA:",30,45,14)
|
||||
if music.enabled() then
|
||||
draw.text("SI",91,45,15)
|
||||
else
|
||||
draw.text("NO",91,45,15)
|
||||
end
|
||||
draw.text("SÓ:",30,55,14)
|
||||
if sound.enabled() then
|
||||
draw.text("SI",91,55,15)
|
||||
else
|
||||
draw.text("NO",91,55,15)
|
||||
end
|
||||
draw.text("EIXIR",30,65,14)
|
||||
|
||||
if key.press(key.ESCAPE) then
|
||||
surf.source(back)
|
||||
draw.surf(0,0,128,96,0,0)
|
||||
surf.source(tiles)
|
||||
game_update = pause_old_update
|
||||
elseif key.press(keyDown) or pad.press(btnDown) then
|
||||
pausa_option = pausa_option + 1
|
||||
if pausa_option == 5 then pausa_option = 1 end
|
||||
elseif key.press(keyUp) or pad.press(btnUp) then
|
||||
pausa_option = pausa_option - 1
|
||||
if pausa_option == 0 then pausa_option = 4 end
|
||||
elseif key.press(keyShoot) or pad.press(btnShoot) then
|
||||
if pausa_option==1 then
|
||||
surf.source(back)
|
||||
draw.surf(0,0,128,96,0,0)
|
||||
surf.source(tiles)
|
||||
game_update = pause_old_update
|
||||
elseif pausa_option==2 then
|
||||
music.enabled(not music.enabled())
|
||||
elseif pausa_option==3 then
|
||||
sound.enabled(not sound.enabled())
|
||||
else
|
||||
game_exit()
|
||||
game_init(true)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
flow:registrar("game", {game_init, update_game} )
|
||||
|
||||
@@ -5,14 +5,10 @@ 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]
|
||||
-- gorro.x=habs[r][2]
|
||||
|
||||
-- gorro.x=habs[r][2]*8
|
||||
gorro.hab=4
|
||||
gorro.x=5
|
||||
local habs={{4,5},{12,10},{21,11},{34,4},{43,1}}
|
||||
local r=1+math.random(0,#habs-1)
|
||||
gorro.hab=habs[r][1]
|
||||
gorro.x=habs[r][2]
|
||||
|
||||
local world_x, world_y = coords.room_to_world(gorro.hab,gorro.x,gorro.y)
|
||||
gorro.x=world_x
|
||||
|
||||
@@ -29,6 +29,8 @@ coords.set_config({
|
||||
rooms_per_floor = mapa_rooms_per_piso,
|
||||
})
|
||||
|
||||
font_default = font.current()
|
||||
|
||||
function images_init()
|
||||
tiles=surf.load("tiles.gif")
|
||||
surf.source(tiles)
|
||||
|
||||
BIN
data/mus_imp.ogg
Normal file
BIN
data/mus_imp.ogg
Normal file
Binary file not shown.
@@ -3,20 +3,31 @@
|
||||
|
||||
o2aX = arcade_config.org2arc_escala
|
||||
|
||||
avatar_abad_x = 3*o2aX
|
||||
avatar_abad2_x = 4*o2aX
|
||||
avatar_abad_x = 6
|
||||
avatar_abad2_x = 8
|
||||
avatar_abad_y = 0
|
||||
avatar_batman_x = 4*o2aX
|
||||
avatar_batman_y = 48*o2aX
|
||||
avatar_premiere_x = 69*o2aX
|
||||
avatar_premiere_y = 20*o2aX
|
||||
avatar_elalien_x = 3*o2aX
|
||||
avatar_elalien_y = 16*o2aX
|
||||
avatar_w = 10*o2aX
|
||||
avatar_h = 10*o2aX
|
||||
avatar_batman_x = 8
|
||||
avatar_batman_y = 96
|
||||
avatar_premiere_x = 138
|
||||
avatar_premiere_y = 40
|
||||
avatar_elalien_x = 6
|
||||
avatar_elalien_y = 32
|
||||
avatar_w = 20
|
||||
avatar_h = 20
|
||||
avatar_imp_x = 134
|
||||
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_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_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_abad_x,y=avatar_abad_y,flip=false,audio="abad",text={"MERDA!!","S'HA ENFADAT!!!","CACAUS A MI!!!!"},die=20},
|
||||
},
|
||||
intro_01= {
|
||||
{x=avatar_abad_x,y=avatar_abad_y,flip=false,audio="abad",text={"Ah!, què bo!","Nit de Netflix amb","un bon bol de cacaus!"},die=20},
|
||||
},
|
||||
@@ -180,6 +191,22 @@ function playtext(snd)
|
||||
end
|
||||
end
|
||||
|
||||
function next_scene()
|
||||
scenes.dnum=scenes.dnum+1
|
||||
scenes.die=scenes.current_scene[scenes.dnum].die or 0
|
||||
scenes.step=2
|
||||
play_music()
|
||||
-- print("NEXT SCENE")
|
||||
end
|
||||
|
||||
function play_music()
|
||||
if scenes.current_scene[scenes.dnum].musica then
|
||||
print("PLAY MUSIC "..scenes.dnum)
|
||||
music.stop()
|
||||
music.play(scenes.current_scene[scenes.dnum].musica)
|
||||
end
|
||||
end
|
||||
|
||||
function draw_scene()
|
||||
local txt_x = not scenes.current_scene[scenes.dnum].flip and 38 or 8
|
||||
|
||||
@@ -287,9 +314,7 @@ function update_scene()
|
||||
flow:next()
|
||||
-- end
|
||||
else
|
||||
scenes.dnum=scenes.dnum+1
|
||||
scenes.die=scenes.current_scene[scenes.dnum].die or 0
|
||||
scenes.step=2
|
||||
next_scene()
|
||||
end
|
||||
end
|
||||
else
|
||||
@@ -314,8 +339,9 @@ function update_scene()
|
||||
end
|
||||
|
||||
if scenes.step>8 then
|
||||
if key.press(keyShoot) or key.press(keyDown) or key.press(keyUp) or key.press(keyLeft) or key.press(keyRight) or key.press(key.RETURN) or
|
||||
pad.press(btnShoot) or pad.press(btnDown) or pad.press(btnUp) or pad.press(btnLeft) or pad.press(btnRight) then
|
||||
if controller:check("shoot") or controller:check("down") or
|
||||
controller:check("up") or controller:check("left") or
|
||||
controller:check("right") or key.press(key.RETURN) then
|
||||
if scenes.dnum==#scenes.current_scene then
|
||||
music.stop()
|
||||
-- if batman.endgame then
|
||||
@@ -326,8 +352,9 @@ function update_scene()
|
||||
flow:next()
|
||||
-- end
|
||||
else
|
||||
scenes.dnum=scenes.dnum+1
|
||||
scenes.step=2
|
||||
-- scenes.dnum=scenes.dnum+1
|
||||
-- scenes.step=2
|
||||
next_scene()
|
||||
end
|
||||
end
|
||||
elseif key.press(keyShoot) or pad.press(btnShoot) then
|
||||
|
||||
@@ -19,7 +19,7 @@ end
|
||||
function trigger:draw()
|
||||
-- do nothing
|
||||
local scr_x, scr_y = viewp:screen_coords( self.x, self.y )
|
||||
draw.rectf(scr_x,scr_y,self.w,self.h,3)
|
||||
draw.rect(scr_x,scr_y,self.w,self.h,3)
|
||||
end
|
||||
|
||||
function trigger:update()
|
||||
@@ -88,6 +88,11 @@ function triggers:escena_habitacio_batman()
|
||||
end
|
||||
end
|
||||
|
||||
function triggers:escena_lluita_imp()
|
||||
start_scene(scenes.lluita_imp)
|
||||
remove_actor(self)
|
||||
end
|
||||
|
||||
-- function triggers:teleport_a()
|
||||
-- abad.teleport=true
|
||||
-- sound.play(audio_hit)
|
||||
|
||||
Reference in New Issue
Block a user