- 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_change_room=300
|
||||
menu_room=rnd(60)
|
||||
playchirp(audio_main_song)
|
||||
else
|
||||
_update=update_game
|
||||
end
|
||||
@@ -276,6 +277,8 @@ function update_game()
|
||||
abad.hab=abad.hab+10
|
||||
elseif btn(KEY_LSHIFT) and btnp(KEY_UP) and hy>0 then
|
||||
abad.hab=abad.hab-10
|
||||
elseif btnp(KEY_ESCAPE) then
|
||||
pause()
|
||||
end
|
||||
if abad.objects.gps~=nil then
|
||||
if btnp(KEY_1) then
|
||||
@@ -325,7 +328,7 @@ function update_menu()
|
||||
fireball.update()
|
||||
switches.update()
|
||||
|
||||
if btn(KEY_SPACE) then
|
||||
if btnp(KEY_SPACE) then
|
||||
game_exit()
|
||||
game_init()
|
||||
end
|
||||
@@ -340,3 +343,31 @@ end
|
||||
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)
|
||||
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
|
||||
intro_wait=400
|
||||
cls(16)
|
||||
logo=newsurf(36,5)
|
||||
setdest(logo)
|
||||
cls(16)
|
||||
prnt("JAILGAMES",0,0,15)
|
||||
@@ -19,7 +18,7 @@ function intro_intro()
|
||||
--text("JAILGAMES",40,30,15)
|
||||
text("presenta",48,50,14)
|
||||
intro_wait=intro_wait-1
|
||||
if intro_wait==0 then
|
||||
if intro_wait==0 or btnp(KEY_ESCAPE) then
|
||||
cls(16)
|
||||
rect(15,3,113,53,2)
|
||||
camera(-16,-4)
|
||||
@@ -35,6 +34,9 @@ end
|
||||
function intro_update()
|
||||
--playchirp(audio_main_song)
|
||||
--game_init(true)
|
||||
if btnp(KEY_ESCAPE) then
|
||||
game_init(true)
|
||||
end
|
||||
|
||||
intro_wait=intro_wait-1
|
||||
if intro_wait==0 then
|
||||
|
||||
2
main.lua
2
main.lua
@@ -4,6 +4,8 @@ function _init()
|
||||
local pal=loadpal("tiles.gif")
|
||||
setpal(pal)
|
||||
|
||||
logo=newsurf(36,5)
|
||||
back=newsurf(128,96)
|
||||
--game_init()
|
||||
intro_init()
|
||||
end
|
||||
|
||||
10
scenes.lua
10
scenes.lua
@@ -1,6 +1,6 @@
|
||||
scenes={
|
||||
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= {
|
||||
{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={
|
||||
{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={
|
||||
{x=4,y=0,flip=false,audio=audio_text_abad,text={"Ale, ja tinc el GPS.","Ara puc trobar tot","el que necessite..."}},
|
||||
@@ -215,6 +216,11 @@ function update_scene()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if btnp(KEY_ESCAPE) then
|
||||
pause()
|
||||
end
|
||||
|
||||
if btnp(KEY_SPACE) then
|
||||
if scenes.step>8 then
|
||||
if scenes.dnum==#scenes.current_scene then
|
||||
|
||||
Reference in New Issue
Block a user