- [NEW] Sound everywhere

- Game logic extracted to game.lua
This commit is contained in:
2022-12-28 12:25:45 +01:00
parent 0a8054c67f
commit 02ad5addad
10 changed files with 378 additions and 350 deletions

View File

@@ -27,13 +27,16 @@ end
function abad_hurt(howmuch) function abad_hurt(howmuch)
if abad.hurting == 0 then if abad.hurting == 0 then
playchirp(audio_abad_hit)
abad.energia=abad.energia-howmuch abad.energia=abad.energia-howmuch
if abad.energia<=0 then if abad.energia<=0 then
abad.vides=abad.vides-1 abad.vides=abad.vides-1
if abad.vides==0 then if abad.vides==0 then
--final de la partida --final de la partida
dead.start() dead.start()
playchirp(audio_game_over, true)
else else
playchirp(audio_life_lost, true)
abad.energia=40 abad.energia=40
abad.hab=abad.safe.hab abad.hab=abad.safe.hab
abad.x=abad.safe.x abad.x=abad.safe.x
@@ -78,6 +81,7 @@ function abad_state_normal()
elseif btn(KEY_DOWN) then elseif btn(KEY_DOWN) then
abad.update=abad_state_crouch abad.update=abad_state_crouch
elseif btnp(KEY_SPACE) and cacau.hab==-1 then elseif btnp(KEY_SPACE) and cacau.hab==-1 then
playchirp(audio_abad_shot)
abad.update=abad_state_fire abad.update=abad_state_fire
abad.wait=0 abad.wait=0
cacau.init(abad.hab,abad.x+8,abad.y+8,abad.flip) cacau.init(abad.hab,abad.x+8,abad.y+8,abad.flip)
@@ -143,7 +147,7 @@ function abad_state_walking()
if abad.wait==6 then if abad.wait==6 then
abad.wait=0 abad.wait=0
abad.step=(abad.step+1)%4 abad.step=(abad.step+1)%2
if abad.step==0 then if abad.step==0 then
playchirp(audio_abad_step[abad.mustep]) playchirp(audio_abad_step[abad.mustep])
abad.mustep = abad.mustep + 1 abad.mustep = abad.mustep + 1

View File

@@ -1,4 +1,15 @@
audio_main_song="t7l1cl0rv2cv4o3l1gl0rv2gv4o4l1cl0rv2cv4l1d#l0rv2d#v4l1dl0rv2dv4o3l1gl0rv2gv4o4l1dl0rv2dv4l1fl0rv2fv4l1d#l0rv2d#v4l1gl0rv2gv4l1fl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rv2bv4o5l1cl0rv2cv4o4l1gl0rv2gv4l1d#l0rv2d#v4l1gl0rv2gv4l3cv3cv2cv1c"
audio_abad_jump="l1rl0c#dd#eff#gg#" audio_abad_jump="v1l1rl0c#dd#eff#gg#"
audio_abad_fall="l1rl0g#gf#fed#dc#" audio_abad_fall="v1l1rl0g#gf#fed#dc#"
audio_abad_step={"v1l1c#", "v1l1o5c#", "v1l1g#", "v1l1o5c#"} audio_abad_step={"t9v1l1c#", "t9v1l1o5c#", "t9v1l1g#", "t9v1l1o5c#"}
audio_switch="t5v3o7l0ev4rv5o0a#aa#aa#aa#a"
audio_abad_hit="t5v3o3l0cv2cv1c"
audio_abad_shot="t5v1o5l0d#o4a#d#"
audio_hit="t5l0v3nv2nv1n"
audio_low="t5l0v3n"
audio_text_abad="t9v1l0o4d#"
audio_text_premiere="t9v1l0o5a#"
audio_text_elalien="t9v1o3l0g#o5c#"
audio_text_batman="t9v1o2l0ag#"
audio_life_lost="t5v3c#v2o5c#v1o4c#o5c#v3o3g#v2o4g#v1o3g#o4g#v3o3ev2o4ev1o3eo4ev3o3g#v2o4g#v1o3g#o4g#v3o3c#v2o4c#v1o3c#o4c#"
audio_game_over="t5v3c#v2o5c#v1o4c#o5c#v3l1ro3l0g#v2o4g#v3o3gv2o4gv3o3g#v2o4g#v3o3av2o4av1o3ao4av3l1ro3l0g#v2o4g#v1o3g#o4g#v3l1rv4l4rv3l0cv2o5cv1o4co5crv3ro4c#v2o5c#v1o4c#o5c#"

View File

@@ -78,7 +78,9 @@ function bambolla.update_normal()
end end
end end
bambolla.y=28-abs(sin(bambolla.x*0.1))*24 bambolla.y=28-abs(sin(bambolla.x*0.1))*24
if bambolla.hab==abad.hab and bambolla.y>25.2 then
playchirp(audio_low)
end
if bambolla.hab==abad.hab then if bambolla.hab==abad.hab then
if cacau.hab==bambolla.hab and aabb(bambolla,cacau) then if cacau.hab==bambolla.hab and aabb(bambolla,cacau) then
bambolla.update=bambolla.update_splash bambolla.update=bambolla.update_splash
@@ -87,6 +89,7 @@ function bambolla.update_normal()
bambolla.y=bambolla.y+8 bambolla.y=bambolla.y+8
bambolla.dx=0 bambolla.dx=0
bambolla.dy=-4 bambolla.dy=-4
playchirp(audio_hit)
end end
if aabb(bambolla,abad) then if aabb(bambolla,abad) then
abad_hurt(1) abad_hurt(1)

View File

@@ -2,4 +2,4 @@ title=Cacaus
width=128 width=128
height=96 height=96
zoom=5 zoom=5
files=audio.lua,dead.lua,scenes.lua,trigger.lua,score.lua,switches.lua,map.lua,mapa.lua,bol.lua,invisible.lua,gota.lua,fireball.lua,cacau.lua,bambolla.lua,imp.lua,gps.lua,peu.lua,gorro.lua,batman.lua,elalien.lua,premiere.lua,caco.lua,zombie.lua,abad.lua,main.lua files=audio.lua,dead.lua,scenes.lua,trigger.lua,score.lua,switches.lua,map.lua,mapa.lua,bol.lua,invisible.lua,gota.lua,fireball.lua,cacau.lua,bambolla.lua,imp.lua,gps.lua,peu.lua,gorro.lua,batman.lua,elalien.lua,premiere.lua,caco.lua,zombie.lua,abad.lua,game.lua,main.lua

294
game.lua Normal file
View File

@@ -0,0 +1,294 @@
--hab=0
modes={playing=0,editing=1}
mode=modes.editing
seltile = 0
actors={}
cameras={}
camera_names={[0]="GPS","Gorro","Peu de Paco","Premiere","EL_ALIEN","BatMan"}
current_camera=0
function remove_actor(actor)
for index, value in pairs(actors) do
if value == actor then
table.remove(actors,index)
end
end
end
function game_init()
actors={}
cameras={}
camera_names={[0]="GPS","Gorro","Peu de Paco","Premiere","EL_ALIEN","BatMan"}
current_camera=0
-- ACTORS PRINCIPALS
abad_init()
table.insert(actors,abad)
gps.init()
table.insert(actors,gps)
gorro.init()
table.insert(actors,gorro)
peu.init()
table.insert(actors,peu)
premiere.init()
table.insert(actors,premiere)
elalien.init()
table.insert(actors,elalien)
batman.init()
table.insert(actors,batman)
bol.init()
table.insert(actors,bol)
-- MALOTES PERSISTENTS
table.insert(actors,gota.new(70,40,8,20))
table.insert(actors,gota.new(70,72,8,30))
table.insert(actors,gota.new(63,40,4,25))
table.insert(actors,gota.new(63,72,4,20))
table.insert(actors,gota.new(64,24,4,10))
table.insert(actors,gota.new(64,48,4,25))
table.insert(actors,gota.new(65,56,4,10))
table.insert(actors,gota.new(65,63,4,25))
table.insert(actors,gota.new(66,24,4,10))
table.insert(actors,gota.new(66,32,4,15))
table.insert(actors,gota.new(77,16,4,30))
table.insert(actors,gota.new(77,72,4,25))
table.insert(actors,invisible.new(77,40,32))
table.insert(actors,invisible.new(77,48,32))
table.insert(actors,invisible.new(58,16,32))
table.insert(actors,invisible.new(58,16,32))
table.insert(actors,zombie.new(2,24,24,false))
table.insert(actors,caco.new(13,24,16,true))
table.insert(actors,caco.new(20,24,16,false))
table.insert(actors,zombie.new(32,24,24,false))
table.insert(actors,caco.new(41,24,16,false))
table.insert(actors,zombie.new(44,24,24,false))
table.insert(actors,caco.new(50,24,16,false))
table.insert(actors,caco.new(61,24,16,false))
table.insert(actors,zombie.new(73,24,24,false))
table.insert(actors,zombie.new(54,24,24,false))
table.insert(actors,zombie.new(68,24,24,false))
table.insert(actors,caco.new(57,24,16,false))
table.insert(actors,zombie.new(46,24,24,false))
table.insert(actors,caco.new(37,24,16,false))
table.insert(actors,caco.new(26,24,16,false))
table.insert(actors,zombie.new(28,24,24,false))
table.insert(actors,caco.new(17,24,16,false))
-- TRIGGERS
table.insert(actors,trigger.new(10,44,32,triggers.escena_abad_inici))
table.insert(actors,trigger.new(11,16,32,triggers.escena_abad_corfes))
table.insert(actors,trigger.new(19,32,32,triggers.escena_habitacio_batman))
score.create()
cameras[0]=gps
table.insert(cameras,gorro)
table.insert(cameras,peu)
table.insert(cameras,premiere)
table.insert(cameras,elalien)
table.insert(cameras,batman)
_update=update_game
end
function text(str,x,y,col)
color(16)
prnt(str,x-1,y-1)
prnt(str,x,y-1)
prnt(str,x+1,y-1)
prnt(str,x-1,y)
prnt(str,x+1,y)
prnt(str,x-1,y+1)
prnt(str,x,y+1)
prnt(str,x+1,y+1)
prnt(str,x,y,col)
end
function draw_hab(hab,x,y,editing)
camera(-x,-y)
mapa_draw(hab)
if not editing then
for key,actor in pairs(actors) do
if actor.hab==hab then
actor:draw()
end
end
if imp.hab==hab then imp.draw() end
if bambolla.hab==hab then bambolla.draw() end
if cacau.hab==hab then cacau:draw() end
if fireball.hab==hab then fireball:draw() end
end
camera(0,0)
end
function update_dialog()
rectfill(16,16,112,50,12)
rect(15,15,113,51,16)
text("Save the map?",20,20,2)
text("This cannot be undone",20,27,2)
text("(Y)es (N)o",25,40,2)
if btnp(KEY_N) then
_update=update_game
elseif btnp(KEY_Y) then
mapa_save()
_update=update_game
end
end
scroll=0
function update_game()
cls(16)
if mode==modes.editing then
draw_hab(abad.hab,0,0,true)
text(abad.hab,120,1,2)
sspr(0,64+scroll*8,128,48,0,48)
color(3)
local xx=(seltile&15)*8
local yy=48+(seltile>>4)*8
rect(xx,yy,xx+8,yy+8)
text("EDIT",100,1,3)
local hx = abad.hab%10
local hy = flr(abad.hab/10)
scroll=0
if btnp(KEY_RIGHT) and hx<9 then
abad.hab=abad.hab+1
elseif btnp(KEY_LEFT) and hx>0 then
abad.hab=abad.hab-1
elseif btnp(KEY_DOWN) and hy<7 then
abad.hab=abad.hab+10
elseif btnp(KEY_UP) and hy>0 then
abad.hab=abad.hab-10
elseif btnp(KEY_RETURN) then
mode=modes.playing
mapa_do_backup()
--playchirp(audio_main_song);
elseif btnp(KEY_S) and (btn(KEY_LCTRL) or btn(KEY_LGUI)) then
_update=update_dialog
elseif btnp(KEY_C) then
mapa_cycle_colors(abad.hab)
elseif btnp(KEY_M) then
mapa_create_minimap()
return
end
if btn(KEY_TAB) then
scroll=2
end
local mx,my=mousex(),mousey()
if mx>>3 < 12 and my>>3 < 6 then
text(mx>>3,100,10,2)
text(my>>3,111,10,2)
text((mx>>3)+(my>>3)*12,118,10,2)
end
if mbtn(1) then
if my>=48 then
seltile=(mx>>3)+((my-48+(scroll*8))>>3)*16
elseif mx<96 then
mapa_set_tile(abad.hab,mx>>3,my>>3,seltile)
end
elseif mbtn(3) then
if my<48 and mx<96 then
mapa_set_tile(abad.hab,mx>>3,my>>3,256)
end
end
if mx>>3 < 12 and my>>3 < 6 then
local tx,ty=(mx>>3)<<3,(my>>3)<<3
rect(tx,ty,tx+8,ty+8,3)
end
else
if abad.hurting == 0 then
draw_hab(abad.hab,0,0)
--text(abad.hab,1,1,2)
draw_hab(cameras[current_camera].hab,0,48)
text(camera_names[current_camera],2,49,8)
score.draw()
setsource(tiles)
prnt("x"..abad.vides,114,13,2)
rectfill(102+(abad.energia>>1),30,122,37,16)
else
sspr(0,0,16,9,50,40,16,9,true)
if abad.hurting > 40 then
prnt("x"..abad.vides+1,63,43,3)
elseif abad.hurting < 20 then
prnt("x"..abad.vides,63,43,2)
end
end
mapa_update(abad.hab,cameras[current_camera].hab)
for key,actor in pairs(actors) do
actor:update()
if actor.hab==cacau.hab and actor~=abad then
if aabb(actor,cacau) then
if actor.hit~=nil then
actor:hit()
cacau.hab=-1
end
end
end
end
imp.update()
bambolla.update()
cacau.update()
fireball.update()
switches.update()
local hx = abad.hab%10
local hy = flr(abad.hab/10)
if btnp(KEY_RETURN) then
mode=modes.editing
mapa_restore_backup()
elseif btn(KEY_LSHIFT) and btnp(KEY_RIGHT) and hx<9 then
abad.hab=abad.hab+1
elseif btn(KEY_LSHIFT) and btnp(KEY_LEFT) and hx>0 then
abad.hab=abad.hab-1
elseif btn(KEY_LSHIFT) and btnp(KEY_DOWN) and hy<7 then
abad.hab=abad.hab+10
elseif btn(KEY_LSHIFT) and btnp(KEY_UP) and hy>0 then
abad.hab=abad.hab-10
end
if abad.objects.gps~=nil then
if btnp(KEY_1) then
if abad.objects.gorro==nil and abad.objects.clau_premiere==nil then current_camera=1 end
elseif btnp(KEY_2) then
if abad.objects.peu==nil and abad.objects.clau_elalien==nil then current_camera=2 end
elseif btnp(KEY_3) then
current_camera=3
elseif btnp(KEY_4) then
current_camera=4
elseif btnp(KEY_5) then
current_camera=5
end
end
end
end
function game_exit()
mapa_restore_backup()
--freesurf(tiles)
actors={}
cameras={}
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

View File

@@ -22,6 +22,7 @@ function gota:update_normal()
self.cx=self.x+2 self.cx=self.x+2
self.dx=0 self.dx=0
self.dy=-4 self.dy=-4
if self.hab==abad.hab then playchirp(audio_low) end
end end
else else
--self.flip=not self.flip --self.flip=not self.flip

View File

@@ -73,6 +73,7 @@ function imp.update()
imp.x=imp.x-2 imp.x=imp.x-2
if imp.x==78 then if imp.x==78 then
fireball.init(imp.hab,imp.x+8,imp.y+4,imp.flip) fireball.init(imp.hab,imp.x+8,imp.y+4,imp.flip)
playchirp(audio_hit)
imp.flip=not imp.flip imp.flip=not imp.flip
elseif imp.x==-12 then elseif imp.x==-12 then
imp.reset() imp.reset()
@@ -81,6 +82,7 @@ function imp.update()
imp.x=imp.x+2 imp.x=imp.x+2
if imp.x==4 then if imp.x==4 then
fireball.init(imp.hab,imp.x+8,imp.y+4,imp.flip) fireball.init(imp.hab,imp.x+8,imp.y+4,imp.flip)
playchirp(audio_hit)
imp.flip=not imp.flip imp.flip=not imp.flip
elseif imp.x==92 then elseif imp.x==92 then
imp.reset() imp.reset()

293
main.lua
View File

@@ -1,301 +1,10 @@
--hab=0
modes={playing=0,editing=1}
mode=modes.editing
seltile = 0
actors={}
cameras={}
camera_names={[0]="GPS","Gorro","Peu de Paco","Premiere","EL_ALIEN","BatMan"}
current_camera=0
function remove_actor(actor)
for index, value in pairs(actors) do
if value == actor then
table.remove(actors,index)
end
end
end
function _init() function _init()
tiles=loadsurf("tiles.gif") tiles=loadsurf("tiles.gif")
setsource(tiles) setsource(tiles)
local pal=loadpal("tiles.gif") local pal=loadpal("tiles.gif")
setpal(pal) setpal(pal)
actors={} game_init()
cameras={}
camera_names={[0]="GPS","Gorro","Peu de Paco","Premiere","EL_ALIEN","BatMan"}
current_camera=0
-- ACTORS PRINCIPALS
abad_init()
table.insert(actors,abad)
gps.init()
table.insert(actors,gps)
gorro.init()
table.insert(actors,gorro)
peu.init()
table.insert(actors,peu)
premiere.init()
table.insert(actors,premiere)
elalien.init()
table.insert(actors,elalien)
batman.init()
table.insert(actors,batman)
bol.init()
table.insert(actors,bol)
-- MALOTES PERSISTENTS
table.insert(actors,gota.new(70,40,8,20))
table.insert(actors,gota.new(70,72,8,30))
table.insert(actors,gota.new(63,40,4,25))
table.insert(actors,gota.new(63,72,4,20))
table.insert(actors,gota.new(64,24,4,10))
table.insert(actors,gota.new(64,56,4,25))
table.insert(actors,gota.new(65,24,4,10))
table.insert(actors,gota.new(65,64,4,25))
table.insert(actors,gota.new(66,24,4,10))
table.insert(actors,gota.new(66,32,4,15))
table.insert(actors,gota.new(77,16,4,30))
table.insert(actors,gota.new(77,72,4,25))
table.insert(actors,invisible.new(77,40,32))
table.insert(actors,invisible.new(77,48,32))
table.insert(actors,invisible.new(58,16,32))
table.insert(actors,invisible.new(58,16,32))
table.insert(actors,zombie.new(2,24,24,false))
table.insert(actors,caco.new(13,24,16,true))
table.insert(actors,caco.new(20,24,16,false))
table.insert(actors,zombie.new(32,24,24,false))
table.insert(actors,caco.new(41,24,16,false))
table.insert(actors,zombie.new(44,24,24,false))
table.insert(actors,caco.new(50,24,16,false))
table.insert(actors,caco.new(61,24,16,false))
table.insert(actors,zombie.new(73,24,24,false))
table.insert(actors,zombie.new(54,24,24,false))
table.insert(actors,zombie.new(68,24,24,false))
table.insert(actors,caco.new(57,24,16,false))
table.insert(actors,zombie.new(46,24,24,false))
table.insert(actors,caco.new(37,24,16,false))
table.insert(actors,caco.new(26,24,16,false))
table.insert(actors,zombie.new(28,24,24,false))
table.insert(actors,caco.new(17,24,16,false))
-- TRIGGERS
table.insert(actors,trigger.new(10,44,32,triggers.escena_abad_inici))
table.insert(actors,trigger.new(11,16,32,triggers.escena_abad_corfes))
table.insert(actors,trigger.new(19,32,32,triggers.escena_habitacio_batman))
score.create()
cameras[0]=gps
table.insert(cameras,gorro)
table.insert(cameras,peu)
table.insert(cameras,premiere)
table.insert(cameras,elalien)
table.insert(cameras,batman)
_update=update_game
end
function text(str,x,y,col)
color(16)
prnt(str,x-1,y-1)
prnt(str,x,y-1)
prnt(str,x+1,y-1)
prnt(str,x-1,y)
prnt(str,x+1,y)
prnt(str,x-1,y+1)
prnt(str,x,y+1)
prnt(str,x+1,y+1)
prnt(str,x,y,col)
end
function draw_hab(hab,x,y,editing)
camera(-x,-y)
mapa_draw(hab)
if not editing then
for key,actor in pairs(actors) do
if actor.hab==hab then
actor:draw()
end
end
if imp.hab==hab then imp.draw() end
if bambolla.hab==hab then bambolla.draw() end
if cacau.hab==hab then cacau:draw() end
if fireball.hab==hab then fireball:draw() end
end
camera(0,0)
end end
function _update() end function _update() end
function update_dialog()
rectfill(16,16,112,50,12)
rect(15,15,113,51,16)
text("Save the map?",20,20,2)
text("This cannot be undone",20,27,2)
text("(Y)es (N)o",25,40,2)
if btnp(KEY_N) then
_update=update_game
elseif btnp(KEY_Y) then
mapa_save()
_update=update_game
end
end
scroll=0
function update_game()
cls(16)
if mode==modes.editing then
draw_hab(abad.hab,0,0,true)
text(abad.hab,120,1,2)
sspr(0,64+scroll*8,128,48,0,48)
color(3)
local xx=(seltile&15)*8
local yy=48+(seltile>>4)*8
rect(xx,yy,xx+8,yy+8)
text("EDIT",100,1,3)
local hx = abad.hab%10
local hy = flr(abad.hab/10)
scroll=0
if btnp(KEY_RIGHT) and hx<9 then
abad.hab=abad.hab+1
elseif btnp(KEY_LEFT) and hx>0 then
abad.hab=abad.hab-1
elseif btnp(KEY_DOWN) and hy<7 then
abad.hab=abad.hab+10
elseif btnp(KEY_UP) and hy>0 then
abad.hab=abad.hab-10
elseif btnp(KEY_RETURN) then
mode=modes.playing
mapa_do_backup()
playchirp(audio_main_song);
elseif btnp(KEY_S) and (btn(KEY_LCTRL) or btn(KEY_LGUI)) then
_update=update_dialog
elseif btnp(KEY_C) then
mapa_cycle_colors(abad.hab)
elseif btnp(KEY_M) then
mapa_create_minimap()
return
end
if btn(KEY_TAB) then
scroll=2
end
local mx,my=mousex(),mousey()
if mx>>3 < 12 and my>>3 < 6 then
text(mx>>3,100,10,2)
text(my>>3,111,10,2)
text((mx>>3)+(my>>3)*12,118,10,2)
end
if mbtn(1) then
if my>=48 then
seltile=(mx>>3)+((my-48+(scroll*8))>>3)*16
elseif mx<96 then
mapa_set_tile(abad.hab,mx>>3,my>>3,seltile)
end
elseif mbtn(3) then
if my<48 and mx<96 then
mapa_set_tile(abad.hab,mx>>3,my>>3,256)
end
end
if mx>>3 < 12 and my>>3 < 6 then
local tx,ty=(mx>>3)<<3,(my>>3)<<3
rect(tx,ty,tx+8,ty+8,3)
end
else
if abad.hurting == 0 then
draw_hab(abad.hab,0,0)
--text(abad.hab,1,1,2)
draw_hab(cameras[current_camera].hab,0,48)
text(camera_names[current_camera],2,49,8)
score.draw()
setsource(tiles)
prnt("x"..abad.vides,114,13,2)
rectfill(102+(abad.energia>>1),30,122,37,16)
else
sspr(0,0,16,9,50,40,16,9,true)
if abad.hurting > 40 then
prnt("x"..abad.vides+1,63,43,3)
elseif abad.hurting < 20 then
prnt("x"..abad.vides,63,43,2)
end
end
mapa_update(abad.hab,cameras[current_camera].hab)
for key,actor in pairs(actors) do
actor:update()
if actor.hab==cacau.hab and actor~=abad then
if aabb(actor,cacau) then
if actor.hit~=nil then
actor:hit()
cacau.hab=-1
end
end
end
end
imp.update()
bambolla.update()
cacau.update()
fireball.update()
switches.update()
local hx = abad.hab%10
local hy = flr(abad.hab/10)
if btnp(KEY_RETURN) then
mode=modes.editing
mapa_restore_backup()
elseif btn(KEY_LSHIFT) and btnp(KEY_RIGHT) and hx<9 then
abad.hab=abad.hab+1
elseif btn(KEY_LSHIFT) and btnp(KEY_LEFT) and hx>0 then
abad.hab=abad.hab-1
elseif btn(KEY_LSHIFT) and btnp(KEY_DOWN) and hy<7 then
abad.hab=abad.hab+10
elseif btn(KEY_LSHIFT) and btnp(KEY_UP) and hy>0 then
abad.hab=abad.hab-10
end
if abad.objects.gps~=nil then
if btnp(KEY_1) then
if abad.objects.gorro==nil and abad.objects.clau_premiere==nil then current_camera=1 end
elseif btnp(KEY_2) then
if abad.objects.peu==nil and abad.objects.clau_elalien==nil then current_camera=2 end
elseif btnp(KEY_3) then
current_camera=3
elseif btnp(KEY_4) then
current_camera=4
elseif btnp(KEY_5) then
current_camera=5
end
end
end
end
function game_exit()
mapa_restore_backup()
freesurf(tiles)
actors={}
cameras={}
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

View File

@@ -1,85 +1,85 @@
scenes={ scenes={
abad_inici={ abad_inici={
{x=4,y=0,flip=false,text={"Se va a enterar eixe","imbècil de Batman","quan el pille..."}}, {x=4,y=0,flip=false,audio=audio_text_abad,text={"Se va a enterar eixe","imbècil de Batman","quan el pille..."}},
{x=4,y=0,flip=false,text={"Gonna per el GPS","per a trobarlo.",""}}, {x=4,y=0,flip=false,audio=audio_text_abad,text={"Gonna per el GPS","per a trobarlo.",""}},
{x=4,y=0,flip=false,text={"I igual hi ha","algú més per ací","que em puga ajudar."}}, {x=4,y=0,flip=false,audio=audio_text_abad,text={"I igual hi ha","algú més per ací","que em puga ajudar."}},
}, },
abad_corfes={ abad_corfes={
{x=4,y=0,flip=false,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,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!"}}
}, },
gps_trobat={ gps_trobat={
{x=4,y=0,flip=false,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..."}},
{x=4,y=0,flip=false,text={"polsant les tecles","del 1 al 5",""}}, {x=4,y=0,flip=false,audio=audio_text_abad,text={"polsant les tecles","del 1 al 5",""}},
}, },
premiere_intro={ premiere_intro={
{x=4,y=0,flip=false,text={"Premiere??","Qué fas per ma casa?",""}}, {x=4,y=0,flip=false,audio=audio_text_abad,text={"Premiere??","Qué fas per ma casa?",""}},
{x=69,y=20,flip=true,text={"Porca miseria!!","l'uomo pipistrello!!","m'ha llevatto il gorro!"}}, {x=69,y=20,flip=true,audio=audio_text_premiere,text={"Porca miseria!!","l'uomo pipistrello!!","m'ha llevatto il gorro!"}},
{x=4,y=0,flip=false,text={"Pipistrello??","Això ques??",""}}, {x=4,y=0,flip=false,audio=audio_text_abad,text={"Pipistrello??","Això ques??",""}},
{x=69,y=20,flip=true,text={"Il batmano!!","Incontrame il gorro","per l'amore d'un porco!"}}, {x=69,y=20,flip=true,audio=audio_text_premiere,text={"Il batmano!!","Incontrame il gorro","per l'amore d'un porco!"}},
{x=4,y=0,flip=false,text={"Tinc faena. A mi m'ha","furtat els cacaus i","he de trobarlos."}}, {x=4,y=0,flip=false,audio=audio_text_abad,text={"Tinc faena. A mi m'ha","furtat els cacaus i","he de trobarlos."}},
{x=69,y=20,flip=true,text={"Lei tenne in su quarto!","Io tengo micha clave!","Achudame i t'achudo!"}} {x=69,y=20,flip=true,audio=audio_text_premiere,text={"Lei tenne in su quarto!","Io tengo micha clave!","Achudame i t'achudo!"}}
}, },
premiere_intro_gorro={ premiere_intro_gorro={
{x=4,y=0,flip=false,text={"Premiere??","Qué fas per ma casa?",""}}, {x=4,y=0,flip=false,audio=audio_text_abad,text={"Premiere??","Qué fas per ma casa?",""}},
{x=69,y=20,flip=true,text={"Porca miseria!!","l'uomo pipistrello!!","m'ha llevatto il gorro!"}}, {x=69,y=20,flip=true,audio=audio_text_premiere,text={"Porca miseria!!","l'uomo pipistrello!!","m'ha llevatto il gorro!"}},
{x=4,y=0,flip=false,text={"Pipistrello??","Això... be, te igual","Ací el tens, atontat."}}, {x=4,y=0,flip=false,audio=audio_text_abad,text={"Pipistrello??","Això... be, te igual","Ací el tens, atontat."}},
{x=69,y=20,flip=true,text={"Per fortuna!","Grazie mille!","Come podo achudarte?"}}, {x=69,y=20,flip=true,audio=audio_text_premiere,text={"Per fortuna!","Grazie mille!","Come podo achudarte?"}},
{x=4,y=0,flip=false,text={"Pos Batman m'ha furtat","els cacaus. Supose que","els te amagats."}}, {x=4,y=0,flip=false,audio=audio_text_abad,text={"Pos Batman m'ha furtat","els cacaus. Supose que","els te amagats."}},
{x=69,y=20,flip=true,text={"In lo suo quarto!","Io tengo micha clave!","Tenne, tenne!!"}} {x=69,y=20,flip=true,audio=audio_text_premiere,text={"In lo suo quarto!","Io tengo micha clave!","Tenne, tenne!!"}}
}, },
premiere_gorro={ premiere_gorro={
{x=4,y=0,flip=false,text={"Tin, el ditxos gorro.","",""}}, {x=4,y=0,flip=false,audio=audio_text_abad,text={"Tin, el ditxos gorro.","",""}},
{x=69,y=20,flip=true,text={"Bravissimo!","Che giornatta","fantastica! Figo!"}}, {x=69,y=20,flip=true,audio=audio_text_premiere,text={"Bravissimo!","Che giornatta","fantastica! Figo!"}},
{x=4,y=0,flip=false,text={"Tu si que eres un","figo. On està eixa","mitja clau?"}}, {x=4,y=0,flip=false,audio=audio_text_abad,text={"Tu si que eres un","figo. On està eixa","mitja clau?"}},
{x=69,y=20,flip=true,text={"Giusto! Aquí tenne!","Buona fortuna per","la tua avventura!"}}, {x=69,y=20,flip=true,audio=audio_text_premiere,text={"Giusto! Aquí tenne!","Buona fortuna per","la tua avventura!"}},
{x=69,y=20,flip=true,text={"E NON TOCARE il","Batmano! Sei molto","poderoso!"}} {x=69,y=20,flip=true,audio=audio_text_premiere,text={"E NON TOCARE il","Batmano! Sei molto","poderoso!"}}
}, },
gorro_trobat_nointro={ gorro_trobat_nointro={
{x=4,y=0,flip=false,text={"Mira, el gorro","de Premiere.","Millor l'agafe."}} {x=4,y=0,flip=false,audio=audio_text_abad,text={"Mira, el gorro","de Premiere.","Millor l'agafe."}}
}, },
gorro_trobat={ gorro_trobat={
{x=4,y=0,flip=false,text={"Mira, el gorro","de Premiere.","A la saca."}} {x=4,y=0,flip=false,audio=audio_text_abad,text={"Mira, el gorro","de Premiere.","A la saca."}}
}, },
elalien_intro={ elalien_intro={
{x=4,y=0,flip=false,text={"Que passa alien?","A tu també t'ha","putejat el Batman?"}}, {x=4,y=0,flip=false,audio=audio_text_abad,text={"Que passa alien?","A tu també t'ha","putejat el Batman?"}},
{x=3,y=16,flip=true,text={"CAGUEN L'OU!!","ESTAVA JO TAN TRANQUIL","PODANT AL MEU GOS..."}}, {x=3,y=16,flip=true,audio=audio_text_elalien,text={"CAGUEN L'OU!!","ESTAVA JO TAN TRANQUIL","PODANT AL MEU GOS..."}},
{x=3,y=16,flip=true,text={"...I QUAN NO MIRABA","M'HA FURTAT EL","MARANÀ!!!"}}, {x=3,y=16,flip=true,audio=audio_text_elalien,text={"...I QUAN NO MIRABA","M'HA FURTAT EL","MARANÀ!!!"}},
{x=4,y=0,flip=false,text={"Es...taves podant","a un gos...?",""}}, {x=4,y=0,flip=false,audio=audio_text_abad,text={"Es...taves podant","a un gos...?",""}},
{x=3,y=16,flip=true,text={"EN JUPITER NO POTS","DEIXAR QUE LI CREIXEN","MES DE 12 PATES!!"}}, {x=3,y=16,flip=true,audio=audio_text_elalien,text={"EN JUPITER NO POTS","DEIXAR QUE LI CREIXEN","MES DE 12 PATES!!"}},
{x=4,y=0,flip=false,text={"Uh... clar...","A mi m'ha furtat","els cacaus."}}, {x=4,y=0,flip=false,audio=audio_text_abad,text={"Uh... clar...","A mi m'ha furtat","els cacaus."}},
{x=3,y=16,flip=true,text={"ELS TÉ EN LA SEUA","HABITACIÓ SEGUR.","TROBA EL BERENAR..."}}, {x=3,y=16,flip=true,audio=audio_text_elalien,text={"ELS TÉ EN LA SEUA","HABITACIÓ SEGUR.","TROBA EL BERENAR..."}},
{x=3,y=16,flip=true,text={"...I JO ET DONARÉ","LA MEITAT DE LA CLAU","PER A ENTRAR."}} {x=3,y=16,flip=true,audio=audio_text_elalien,text={"...I JO ET DONARÉ","LA MEITAT DE LA CLAU","PER A ENTRAR."}}
}, },
elalien_intro_peu={ elalien_intro_peu={
{x=4,y=0,flip=false,text={"Que passa alien?","A tu també t'ha","putejat el Batman?"}}, {x=4,y=0,flip=false,audio=audio_text_abad,text={"Que passa alien?","A tu també t'ha","putejat el Batman?"}},
{x=3,y=16,flip=true,text={"CAGUEN L'OU!!","ESTAVA JO TAN TRANQUIL","PODANT AL MEU GOS..."}}, {x=3,y=16,flip=true,audio=audio_text_elalien,text={"CAGUEN L'OU!!","ESTAVA JO TAN TRANQUIL","PODANT AL MEU GOS..."}},
{x=3,y=16,flip=true,text={"...I QUAN NO MIRABA","M'HA FURTAT EL","MARANÀ!!!"}}, {x=3,y=16,flip=true,audio=audio_text_elalien,text={"...I QUAN NO MIRABA","M'HA FURTAT EL","MARANÀ!!!"}},
{x=4,y=0,flip=false,text={"Podant...? be, te","igual. Açò deu ser","el teu berenar."}}, {x=4,y=0,flip=false,audio=audio_text_abad,text={"Podant...? be, te","igual. Açò deu ser","el teu berenar."}},
{x=3,y=16,flip=true,text={"OSTI QUE BÓ!!!","GRACIES AUELO!","A TU QUE T'HA FET?"}}, {x=3,y=16,flip=true,audio=audio_text_elalien,text={"OSTI QUE BÓ!!!","GRACIES AUELO!","A TU QUE T'HA FET?"}},
{x=4,y=0,flip=false,text={"M'ha furtat els cacaus.","Segur que els té","al seu quarto."}}, {x=4,y=0,flip=false,audio=audio_text_abad,text={"M'ha furtat els cacaus.","Segur que els té","al seu quarto."}},
{x=3,y=16,flip=true,text={"SEGUR! PERO JO TINC","LA MEITAT DE LA CLAU.","TIN, I SORT!"}} {x=3,y=16,flip=true,audio=audio_text_elalien,text={"SEGUR! PERO JO TINC","LA MEITAT DE LA CLAU.","TIN, I SORT!"}}
}, },
elalien_peu={ elalien_peu={
{x=4,y=0,flip=false,text={"Ací tens...","Uff, que peste fa...",""}}, {x=4,y=0,flip=false,audio=audio_text_abad,text={"Ací tens...","Uff, que peste fa...",""}},
{x=3,y=16,flip=true,text={"GRACIES!!!","SÍ, EH? QUE","SUCOSET I BÓ."}}, {x=3,y=16,flip=true,audio=audio_text_elalien,text={"GRACIES!!!","SÍ, EH? QUE","SUCOSET I BÓ."}},
{x=4,y=0,flip=false,text={"Clar...","Be, i eixa","mitja clau?"}}, {x=4,y=0,flip=false,audio=audio_text_abad,text={"Clar...","Be, i eixa","mitja clau?"}},
{x=3,y=16,flip=true,text={"TIN! QUAN TINGUES","ELS CACAUS, PEGA-LI","CACAUÀ A BATMAN!"}}, {x=3,y=16,flip=true,audio=audio_text_elalien,text={"TIN! QUAN TINGUES","ELS CACAUS, PEGA-LI","CACAUÀ A BATMAN!"}},
}, },
peu_trobat_nointro={ peu_trobat_nointro={
{x=4,y=0,flip=false,text={"Un peu podrit??","Qué asco!! Segur","que és d'el alien."}} {x=4,y=0,flip=false,audio=audio_text_abad,text={"Un peu podrit??","Qué asco!! Segur","que és d'el alien."}}
}, },
peu_trobat={ peu_trobat={
{x=4,y=0,flip=false,text={"Joer, açò deu ser","el berenar d'el alien.","Ecs..."}} {x=4,y=0,flip=false,audio=audio_text_abad,text={"Joer, açò deu ser","el berenar d'el alien.","Ecs..."}}
}, },
habitacio_batman={ habitacio_batman={
{x=4,y=0,flip=false,text={"L'habitació de Batman!","Segur que els cacaus","estàn ahí dins."}}, {x=4,y=0,flip=false,audio=audio_text_abad,text={"L'habitació de Batman!","Segur que els cacaus","estàn ahí dins."}},
{x=4,y=0,flip=false,text={"Però necessite","una clau...",""}} {x=4,y=0,flip=false,audio=audio_text_abad,text={"Però necessite","una clau...",""}}
}, },
bol_trobat={ bol_trobat={
{x=4,y=0,flip=false,text={"PER FI, JA TINC","ELS MEUS CACAUS!!!","OLE!! OLE!!"}}, {x=4,y=0,flip=false,audio=audio_text_abad,text={"PER FI, JA TINC","ELS MEUS CACAUS!!!","OLE!! OLE!!"}},
{x=4,y=0,flip=false,text={"Se va a enterar","Batman ara quan","el pille..."}}, {x=4,y=0,flip=false,audio=audio_text_abad,text={"Se va a enterar","Batman ara quan","el pille..."}},
{x=4,y=0,flip=false,text={"Ara si que li puc","pegar una bona","cacauà..."}} {x=4,y=0,flip=false,audio=audio_text_abad,text={"Ara si que li puc","pegar una bona","cacauà..."}}
}, },
} }
@@ -134,6 +134,7 @@ function draw_scene()
if scenes.char<#scenes.current_scene[scenes.dnum].text[1] then if scenes.char<#scenes.current_scene[scenes.dnum].text[1] then
scenes.step=scenes.step-1 scenes.step=scenes.step-1
scenes.char=scenes.char+1 scenes.char=scenes.char+1
playchirp(scenes.current_scene[scenes.dnum].audio)
else else
scenes.char=1 scenes.char=1
end end
@@ -142,6 +143,7 @@ function draw_scene()
if scenes.char<#scenes.current_scene[scenes.dnum].text[2] then if scenes.char<#scenes.current_scene[scenes.dnum].text[2] then
scenes.step=scenes.step-1 scenes.step=scenes.step-1
scenes.char=scenes.char+1 scenes.char=scenes.char+1
playchirp(scenes.current_scene[scenes.dnum].audio)
else else
scenes.char=1 scenes.char=1
end end
@@ -150,6 +152,7 @@ function draw_scene()
if scenes.char<#scenes.current_scene[scenes.dnum].text[3] then if scenes.char<#scenes.current_scene[scenes.dnum].text[3] then
scenes.step=scenes.step-1 scenes.step=scenes.step-1
scenes.char=scenes.char+1 scenes.char=scenes.char+1
playchirp(scenes.current_scene[scenes.dnum].audio)
else else
scenes.char=1 scenes.char=1
end end

View File

@@ -24,6 +24,7 @@ function switches.start(hab,tile)
switches.current_index=2 switches.current_index=2
switches.wait=0 switches.wait=0
switches.cooldown=60 switches.cooldown=60
playchirp(audio_switch)
end end
function switches.update() function switches.update()