- Menu de pausa, altres apanyos
This commit is contained in:
33
game.lua
33
game.lua
@@ -110,6 +110,7 @@ function game_init(menu)
|
|||||||
menu_count=0
|
menu_count=0
|
||||||
menu_change_room=300
|
menu_change_room=300
|
||||||
menu_room=rnd(60)
|
menu_room=rnd(60)
|
||||||
|
playchirp(audio_main_song)
|
||||||
else
|
else
|
||||||
_update=update_game
|
_update=update_game
|
||||||
end
|
end
|
||||||
@@ -276,6 +277,8 @@ function update_game()
|
|||||||
abad.hab=abad.hab+10
|
abad.hab=abad.hab+10
|
||||||
elseif btn(KEY_LSHIFT) and btnp(KEY_UP) and hy>0 then
|
elseif btn(KEY_LSHIFT) and btnp(KEY_UP) and hy>0 then
|
||||||
abad.hab=abad.hab-10
|
abad.hab=abad.hab-10
|
||||||
|
elseif btnp(KEY_ESCAPE) then
|
||||||
|
pause()
|
||||||
end
|
end
|
||||||
if abad.objects.gps~=nil then
|
if abad.objects.gps~=nil then
|
||||||
if btnp(KEY_1) then
|
if btnp(KEY_1) then
|
||||||
@@ -325,7 +328,7 @@ function update_menu()
|
|||||||
fireball.update()
|
fireball.update()
|
||||||
switches.update()
|
switches.update()
|
||||||
|
|
||||||
if btn(KEY_SPACE) then
|
if btnp(KEY_SPACE) then
|
||||||
game_exit()
|
game_exit()
|
||||||
game_init()
|
game_init()
|
||||||
end
|
end
|
||||||
@@ -340,3 +343,31 @@ end
|
|||||||
function aabb(a, b)
|
function aabb(a, b)
|
||||||
return (a.x+a.bb.x+a.bb.w >= b.x+b.bb.x) and (a.x+a.bb.x <= b.x+b.bb.x+b.bb.w) and (a.y+a.bb.y+a.bb.h >= b.y+b.bb.y) and (a.y+a.bb.y <= b.y+b.bb.y+b.bb.h)
|
return (a.x+a.bb.x+a.bb.w >= b.x+b.bb.x) and (a.x+a.bb.x <= b.x+b.bb.x+b.bb.w) and (a.y+a.bb.y+a.bb.h >= b.y+b.bb.y) and (a.y+a.bb.y <= b.y+b.bb.y+b.bb.h)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function pause()
|
||||||
|
setsource(0)
|
||||||
|
setdest(back)
|
||||||
|
sspr(0,0,128,96,0,0)
|
||||||
|
setdest(0)
|
||||||
|
setsource(tiles)
|
||||||
|
old_update=_update
|
||||||
|
_update=update_pause
|
||||||
|
end
|
||||||
|
|
||||||
|
function update_pause()
|
||||||
|
rectfill(16,16,112,80,16)
|
||||||
|
rect(16,16,112,80,15)
|
||||||
|
prnt("PAUSA",54,30,15)
|
||||||
|
prnt("ESC torna al joc",30,50,14)
|
||||||
|
prnt("SPACE eixir",30,60,14)
|
||||||
|
|
||||||
|
if btnp(KEY_ESCAPE) then
|
||||||
|
setsource(back)
|
||||||
|
sspr(0,0,128,96,0,0)
|
||||||
|
setsource(tiles)
|
||||||
|
_update = old_update
|
||||||
|
elseif btnp(KEY_SPACE) then
|
||||||
|
game_exit()
|
||||||
|
game_init(true)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ function intro_init()
|
|||||||
_update = intro_intro
|
_update = intro_intro
|
||||||
intro_wait=400
|
intro_wait=400
|
||||||
cls(16)
|
cls(16)
|
||||||
logo=newsurf(36,5)
|
|
||||||
setdest(logo)
|
setdest(logo)
|
||||||
cls(16)
|
cls(16)
|
||||||
prnt("JAILGAMES",0,0,15)
|
prnt("JAILGAMES",0,0,15)
|
||||||
@@ -19,7 +18,7 @@ function intro_intro()
|
|||||||
--text("JAILGAMES",40,30,15)
|
--text("JAILGAMES",40,30,15)
|
||||||
text("presenta",48,50,14)
|
text("presenta",48,50,14)
|
||||||
intro_wait=intro_wait-1
|
intro_wait=intro_wait-1
|
||||||
if intro_wait==0 then
|
if intro_wait==0 or btnp(KEY_ESCAPE) then
|
||||||
cls(16)
|
cls(16)
|
||||||
rect(15,3,113,53,2)
|
rect(15,3,113,53,2)
|
||||||
camera(-16,-4)
|
camera(-16,-4)
|
||||||
@@ -35,6 +34,9 @@ end
|
|||||||
function intro_update()
|
function intro_update()
|
||||||
--playchirp(audio_main_song)
|
--playchirp(audio_main_song)
|
||||||
--game_init(true)
|
--game_init(true)
|
||||||
|
if btnp(KEY_ESCAPE) then
|
||||||
|
game_init(true)
|
||||||
|
end
|
||||||
|
|
||||||
intro_wait=intro_wait-1
|
intro_wait=intro_wait-1
|
||||||
if intro_wait==0 then
|
if intro_wait==0 then
|
||||||
|
|||||||
2
main.lua
2
main.lua
@@ -4,6 +4,8 @@ function _init()
|
|||||||
local pal=loadpal("tiles.gif")
|
local pal=loadpal("tiles.gif")
|
||||||
setpal(pal)
|
setpal(pal)
|
||||||
|
|
||||||
|
logo=newsurf(36,5)
|
||||||
|
back=newsurf(128,96)
|
||||||
--game_init()
|
--game_init()
|
||||||
intro_init()
|
intro_init()
|
||||||
end
|
end
|
||||||
|
|||||||
12
scenes.lua
12
scenes.lua
@@ -1,6 +1,6 @@
|
|||||||
scenes={
|
scenes={
|
||||||
intro_01= {
|
intro_01= {
|
||||||
{x=3,y=0,flip=false,audio=audio_text_abad,text={"Aaaah, que bo!","Nit de Netflix amb","un bon bol de cacaus!"},die=20},
|
{x=3,y=0,flip=false,audio=audio_text_abad,text={"Ah!, que bo!","Nit de Netflix amb","un bon bol de cacaus!"},die=20},
|
||||||
},
|
},
|
||||||
intro_02= {
|
intro_02= {
|
||||||
{x=3,y=0,flip=false,audio=audio_text_abad,text={"Eh! On està el","bol de cacaus???",""},die=20},
|
{x=3,y=0,flip=false,audio=audio_text_abad,text={"Eh! On està el","bol de cacaus???",""},die=20},
|
||||||
@@ -23,7 +23,8 @@ scenes={
|
|||||||
},
|
},
|
||||||
abad_corfes={
|
abad_corfes={
|
||||||
{x=4,y=0,flip=false,audio=audio_text_abad,text={"Osti, està ple de","monstruacos.",""}},
|
{x=4,y=0,flip=false,audio=audio_text_abad,text={"Osti, està ple de","monstruacos.",""}},
|
||||||
{x=4,y=0,flip=false,audio=audio_text_abad,text={"Pos al que s'acoste","s'endurà una corfa","de cacau al cap!"}}
|
{x=4,y=0,flip=false,audio=audio_text_abad,text={"Pos al que s'acoste","s'endurà una corfa","de cacau al cap!"}},
|
||||||
|
{x=4,y=0,flip=false,audio=audio_text_abad,text={"I si van altets","igual val la pena","ajupir-se..."}}
|
||||||
},
|
},
|
||||||
gps_trobat={
|
gps_trobat={
|
||||||
{x=4,y=0,flip=false,audio=audio_text_abad,text={"Ale, ja tinc el GPS.","Ara puc trobar tot","el que necessite..."}},
|
{x=4,y=0,flip=false,audio=audio_text_abad,text={"Ale, ja tinc el GPS.","Ara puc trobar tot","el que necessite..."}},
|
||||||
@@ -191,7 +192,7 @@ function draw_scene()
|
|||||||
text(scenes.current_scene[scenes.dnum].text[1],txt_x,7,2)
|
text(scenes.current_scene[scenes.dnum].text[1],txt_x,7,2)
|
||||||
text(scenes.current_scene[scenes.dnum].text[2],txt_x,15,2)
|
text(scenes.current_scene[scenes.dnum].text[2],txt_x,15,2)
|
||||||
text(scenes.current_scene[scenes.dnum].text[3],txt_x,23,2)
|
text(scenes.current_scene[scenes.dnum].text[3],txt_x,23,2)
|
||||||
end
|
end
|
||||||
if scenes.step<=8 then scenes.step=scenes.step+1 end
|
if scenes.step<=8 then scenes.step=scenes.step+1 end
|
||||||
camera(0,0)
|
camera(0,0)
|
||||||
end
|
end
|
||||||
@@ -215,6 +216,11 @@ function update_scene()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if btnp(KEY_ESCAPE) then
|
||||||
|
pause()
|
||||||
|
end
|
||||||
|
|
||||||
if btnp(KEY_SPACE) then
|
if btnp(KEY_SPACE) then
|
||||||
if scenes.step>8 then
|
if scenes.step>8 then
|
||||||
if scenes.dnum==#scenes.current_scene then
|
if scenes.dnum==#scenes.current_scene then
|
||||||
|
|||||||
Reference in New Issue
Block a user