- final cutscenes finished
- fade system - minor changes to stairs graphic
This commit is contained in:
@@ -18,6 +18,7 @@ end
|
|||||||
|
|
||||||
function batman.hit()
|
function batman.hit()
|
||||||
if abad.objects.bol~=nil then
|
if abad.objects.bol~=nil then
|
||||||
|
batman.endgame=true
|
||||||
-- Start end of the game
|
-- Start end of the game
|
||||||
start_scene(scenes.final)
|
start_scene(scenes.final)
|
||||||
end
|
end
|
||||||
|
|||||||
99
fade.lua
Normal file
99
fade.lua
Normal file
@@ -0,0 +1,99 @@
|
|||||||
|
fade = {
|
||||||
|
table={13,15,5,3,12,5,6,7,12,9,10,16,9,13,14},
|
||||||
|
pal={},
|
||||||
|
old_update=nil,
|
||||||
|
wait=0,
|
||||||
|
step=0,
|
||||||
|
outin=false,
|
||||||
|
|
||||||
|
init = function()
|
||||||
|
for i=1,15 do
|
||||||
|
local r,g,b=getcolor(i)
|
||||||
|
fade.pal[i]={r,g,b}
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
|
||||||
|
getstep=function(num,steps)
|
||||||
|
if steps==0 or num==16 then return num end
|
||||||
|
for i=1,steps do
|
||||||
|
num=fade.table[num]
|
||||||
|
if num==16 then return num end
|
||||||
|
end
|
||||||
|
return num
|
||||||
|
end,
|
||||||
|
|
||||||
|
fadeout = function()
|
||||||
|
--print("fading out")
|
||||||
|
fade.old_update=_update
|
||||||
|
_update=fade.update_fadeout
|
||||||
|
fade.wait=0
|
||||||
|
fade.step=0
|
||||||
|
end,
|
||||||
|
|
||||||
|
fadeoutin = function()
|
||||||
|
--print("fading outin")
|
||||||
|
fade.old_update=_update
|
||||||
|
_update=fade.update_fadeout
|
||||||
|
fade.wait=0
|
||||||
|
fade.step=0
|
||||||
|
fade.outin=true
|
||||||
|
end,
|
||||||
|
|
||||||
|
update_fadeout=function()
|
||||||
|
--print("out")
|
||||||
|
fade.wait=fade.wait+1
|
||||||
|
if fade.wait==6 then
|
||||||
|
fade.wait=0
|
||||||
|
for i=1,15 do
|
||||||
|
local v=fade.getstep(i,fade.step)
|
||||||
|
--print(v)
|
||||||
|
if v==16 then
|
||||||
|
setcolor(i,0,0,0)
|
||||||
|
else
|
||||||
|
setcolor(i,fade.pal[v][1],fade.pal[v][2],fade.pal[v][3])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
fade.step=fade.step+1
|
||||||
|
if fade.step==7 then
|
||||||
|
_update = fade.old_update
|
||||||
|
if fade.outin then
|
||||||
|
fade.outin=false;
|
||||||
|
fade.fadein()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
|
||||||
|
fadein = function()
|
||||||
|
--print("fading in")
|
||||||
|
fade.old_update=_update
|
||||||
|
_update=fade.update_fadein
|
||||||
|
fade.wait=0
|
||||||
|
fade.step=6
|
||||||
|
for i=1,15 do setcolor(i,0,0,0) end
|
||||||
|
end,
|
||||||
|
|
||||||
|
update_fadein=function()
|
||||||
|
--print("in")
|
||||||
|
fade.old_update()
|
||||||
|
|
||||||
|
fade.wait=fade.wait+1
|
||||||
|
if fade.wait==6 then
|
||||||
|
fade.wait=0
|
||||||
|
for i=1,15 do
|
||||||
|
local v=fade.getstep(i,fade.step)
|
||||||
|
--print(v)
|
||||||
|
if v==16 then
|
||||||
|
setcolor(i,0,0,0)
|
||||||
|
else
|
||||||
|
setcolor(i,fade.pal[v][1],fade.pal[v][2],fade.pal[v][3])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
fade.step=fade.step-1
|
||||||
|
if fade.step<0 then
|
||||||
|
_update = fade.old_update
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
}
|
||||||
44
final.lua
44
final.lua
@@ -5,14 +5,17 @@ function final_init()
|
|||||||
cameras={}
|
cameras={}
|
||||||
current_actor=1
|
current_actor=1
|
||||||
|
|
||||||
--table.insert(actors,zombie.new(2,24,24,false))
|
|
||||||
|
|
||||||
abad.update = abad_nop
|
abad.update = abad_nop
|
||||||
_update=update_final
|
_update=update_final
|
||||||
next_actor()
|
next_actor()
|
||||||
play(audio_final)
|
play(audio_final)
|
||||||
|
local r,g,b=getcolor(15)
|
||||||
|
setcolor(17,r,g,b)
|
||||||
|
--fade.fadein()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
go_next_actor=false
|
||||||
|
|
||||||
function update_final()
|
function update_final()
|
||||||
cls(16)
|
cls(16)
|
||||||
|
|
||||||
@@ -25,7 +28,7 @@ function update_final()
|
|||||||
rectfill(114,0,191,96,16)
|
rectfill(114,0,191,96,16)
|
||||||
rect(15,40,113,89,2)
|
rect(15,40,113,89,2)
|
||||||
|
|
||||||
text("C A C A U S", 42, 12, 15)
|
text("C A C A U S", 42, 12, 17)
|
||||||
text(actor.name, 64-(#actor.name*2), 28, 11)
|
text(actor.name, 64-(#actor.name*2), 28, 11)
|
||||||
|
|
||||||
mapa_update(abad.hab,final_room)
|
mapa_update(abad.hab,final_room)
|
||||||
@@ -38,6 +41,8 @@ function update_final()
|
|||||||
play(audio_final)
|
play(audio_final)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if go_next_actor then next_actor() end
|
||||||
end
|
end
|
||||||
|
|
||||||
function init_actor(name,flipped,w,h,anim)
|
function init_actor(name,flipped,w,h,anim)
|
||||||
@@ -80,7 +85,9 @@ function draw_actor()
|
|||||||
end
|
end
|
||||||
|
|
||||||
if actor.x>96 or actor.x<-actor.w or (#actor.anim==1 and actor.center_count==0) then
|
if actor.x>96 or actor.x<-actor.w or (#actor.anim==1 and actor.center_count==0) then
|
||||||
next_actor()
|
go_next_actor=true
|
||||||
|
fade.fadeoutin()
|
||||||
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -89,6 +96,8 @@ function draw_actor()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function next_actor()
|
function next_actor()
|
||||||
|
go_next_actor=false
|
||||||
|
faded = true
|
||||||
if current_actor==1 then
|
if current_actor==1 then
|
||||||
init_actor("ZOMBIE",false,16,16,{16,17,16,18})
|
init_actor("ZOMBIE",false,16,16,{16,17,16,18})
|
||||||
elseif current_actor==2 then
|
elseif current_actor==2 then
|
||||||
@@ -117,11 +126,32 @@ function next_actor()
|
|||||||
init_actor("BATMAN",false,16,16,{24,25,24,26})
|
init_actor("BATMAN",false,16,16,{24,25,24,26})
|
||||||
elseif current_actor==13 then
|
elseif current_actor==13 then
|
||||||
init_actor("EL ABAD",true,16,16,{0,1,0,2})
|
init_actor("EL ABAD",true,16,16,{0,1,0,2})
|
||||||
|
elseif current_actor==14 then
|
||||||
|
final_count=0
|
||||||
|
_update=update_final2
|
||||||
|
fade.fadeoutin()
|
||||||
end
|
end
|
||||||
final_room=final_rooms[current_actor]
|
final_room=final_rooms[current_actor]
|
||||||
current_actor=current_actor+1
|
current_actor=current_actor+1
|
||||||
end
|
end
|
||||||
|
|
||||||
---bol de cacaus
|
function update_final2()
|
||||||
--batman
|
cls(16)
|
||||||
--abad
|
|
||||||
|
text("C A C A U S", 42, 12, 17)
|
||||||
|
text("GRACIES PER JUGAR", 30, 48, 10)
|
||||||
|
|
||||||
|
if btnp(KEY_M) then
|
||||||
|
mute = not mute
|
||||||
|
if mute then
|
||||||
|
stopchirp()
|
||||||
|
else
|
||||||
|
play(audio_final)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
final_count=final_count+1
|
||||||
|
if final_count==200 or btnp(KEY_SPACE) or btnp(KEY_RETURN) then
|
||||||
|
game_init(true)
|
||||||
|
fade.fadeoutin()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|||||||
2
game.ini
2
game.ini
@@ -2,4 +2,4 @@ title=Cacaus
|
|||||||
width=128
|
width=128
|
||||||
height=96
|
height=96
|
||||||
zoom=5
|
zoom=5
|
||||||
files=final.lua,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,intro.lua,game.lua,main.lua
|
files=final.lua,fade.lua,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,intro.lua,game.lua,main.lua
|
||||||
|
|||||||
5
game.lua
5
game.lua
@@ -97,7 +97,7 @@ function game_init(menu)
|
|||||||
table.insert(actors,caco.new(17,24,16,false))
|
table.insert(actors,caco.new(17,24,16,false))
|
||||||
|
|
||||||
-- TRIGGERS
|
-- TRIGGERS
|
||||||
if not menu then table.insert(actors,trigger.new(10,44,32,triggers.escena_abad_inici)) end
|
if not menu then table.insert(actors,trigger.new(10,57,32,triggers.escena_abad_inici)) end
|
||||||
table.insert(actors,trigger.new(11,16,32,triggers.escena_abad_corfes))
|
table.insert(actors,trigger.new(11,16,32,triggers.escena_abad_corfes))
|
||||||
|
|
||||||
table.insert(actors,trigger.new(31,12,32,triggers.escena_abad_portes))
|
table.insert(actors,trigger.new(31,12,32,triggers.escena_abad_portes))
|
||||||
@@ -128,7 +128,9 @@ function game_init(menu)
|
|||||||
play(audio_main_song)
|
play(audio_main_song)
|
||||||
else
|
else
|
||||||
_update=update_game
|
_update=update_game
|
||||||
|
stopchirp()
|
||||||
end
|
end
|
||||||
|
--fade.fadein()
|
||||||
end
|
end
|
||||||
|
|
||||||
function text(str,x,y,col)
|
function text(str,x,y,col)
|
||||||
@@ -348,6 +350,7 @@ function update_menu()
|
|||||||
if btnp(KEY_SPACE) then
|
if btnp(KEY_SPACE) then
|
||||||
game_exit()
|
game_exit()
|
||||||
game_init()
|
game_init()
|
||||||
|
fade.fadeoutin()
|
||||||
elseif btnp(KEY_M) then
|
elseif btnp(KEY_M) then
|
||||||
mute = not mute
|
mute = not mute
|
||||||
if mute then
|
if mute then
|
||||||
|
|||||||
54
intro.lua
54
intro.lua
@@ -12,6 +12,7 @@ function intro_init()
|
|||||||
setsource(logo)
|
setsource(logo)
|
||||||
sspr(0,0,36,5,28,35,72,10)
|
sspr(0,0,36,5,28,35,72,10)
|
||||||
setsource(tiles)
|
setsource(tiles)
|
||||||
|
fade.fadein()
|
||||||
end
|
end
|
||||||
|
|
||||||
function intro_intro()
|
function intro_intro()
|
||||||
@@ -19,15 +20,9 @@ function intro_intro()
|
|||||||
text("presenta",48,50,14)
|
text("presenta",48,50,14)
|
||||||
intro_wait=intro_wait-1
|
intro_wait=intro_wait-1
|
||||||
if intro_wait==0 or btnp(KEY_ESCAPE) or btnp(KEY_SPACE) then
|
if intro_wait==0 or btnp(KEY_ESCAPE) or btnp(KEY_SPACE) then
|
||||||
cls(16)
|
intro_wait=1
|
||||||
rect(15,3,113,53,2)
|
|
||||||
camera(-16,-4)
|
|
||||||
mapa_draw(10)
|
|
||||||
rectfill(73,24,79,39,16)
|
|
||||||
sspr(0,0,16,16,44,24,16,16,true)
|
|
||||||
camera(0,0)
|
|
||||||
intro_wait=40
|
|
||||||
_update = intro_update
|
_update = intro_update
|
||||||
|
fade.fadeoutin()
|
||||||
end
|
end
|
||||||
if btnp(KEY_M) then
|
if btnp(KEY_M) then
|
||||||
mute = not mute
|
mute = not mute
|
||||||
@@ -35,10 +30,13 @@ function intro_intro()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function intro_update()
|
function intro_update()
|
||||||
|
--print("intro_update")
|
||||||
--play(audio_main_song)
|
--play(audio_main_song)
|
||||||
--game_init(true)
|
--game_init(true)
|
||||||
if btnp(KEY_ESCAPE) then
|
if btnp(KEY_ESCAPE) then
|
||||||
game_init(true)
|
game_init(true)
|
||||||
|
elseif btnp(KEY_SPACE) then
|
||||||
|
intro_wait=1
|
||||||
elseif btnp(KEY_M) then
|
elseif btnp(KEY_M) then
|
||||||
mute = not mute
|
mute = not mute
|
||||||
end
|
end
|
||||||
@@ -46,9 +44,18 @@ function intro_update()
|
|||||||
intro_wait=intro_wait-1
|
intro_wait=intro_wait-1
|
||||||
if intro_wait==0 then
|
if intro_wait==0 then
|
||||||
if intro_step==0 then
|
if intro_step==0 then
|
||||||
start_scene(scenes.intro_01,58)
|
cls(16)
|
||||||
intro_step=1
|
rect(15,3,113,53,2)
|
||||||
|
camera(-16,-4)
|
||||||
|
mapa_draw(10)
|
||||||
|
rectfill(73,24,79,39,16)
|
||||||
|
sspr(0,0,16,16,44,24,16,16,true)
|
||||||
|
camera(0,0)
|
||||||
|
intro_step=intro_step+1
|
||||||
elseif intro_step==1 then
|
elseif intro_step==1 then
|
||||||
|
start_scene(scenes.intro_01,58)
|
||||||
|
intro_step=intro_step+1
|
||||||
|
elseif intro_step==2 then
|
||||||
cls(16)
|
cls(16)
|
||||||
rect(15,3,113,53,2)
|
rect(15,3,113,53,2)
|
||||||
camera(-16,-4)
|
camera(-16,-4)
|
||||||
@@ -56,11 +63,11 @@ function intro_update()
|
|||||||
rectfill(73,24,79,39,16)
|
rectfill(73,24,79,39,16)
|
||||||
sspr(0,0,16,16,44,24,16,16,false)
|
sspr(0,0,16,16,44,24,16,16,false)
|
||||||
camera(0,0)
|
camera(0,0)
|
||||||
intro_step=2
|
intro_step=intro_step+1
|
||||||
elseif intro_step==2 then
|
|
||||||
start_scene(scenes.intro_02,58)
|
|
||||||
intro_step=3
|
|
||||||
elseif intro_step==3 then
|
elseif intro_step==3 then
|
||||||
|
start_scene(scenes.intro_02,58)
|
||||||
|
intro_step=intro_step+1
|
||||||
|
elseif intro_step==4 then
|
||||||
cls(16)
|
cls(16)
|
||||||
rect(15,3,113,53,2)
|
rect(15,3,113,53,2)
|
||||||
camera(-16,-4)
|
camera(-16,-4)
|
||||||
@@ -70,11 +77,11 @@ function intro_update()
|
|||||||
sspr(112,88,16,8,76,32,16,8,true)
|
sspr(112,88,16,8,76,32,16,8,true)
|
||||||
sspr(0,48,16,16,82,24,16,16,true)
|
sspr(0,48,16,16,82,24,16,16,true)
|
||||||
camera(0,0)
|
camera(0,0)
|
||||||
intro_step=4
|
intro_step=intro_step+1
|
||||||
elseif intro_step==4 then
|
|
||||||
start_scene(scenes.intro_03,58)
|
|
||||||
intro_step=5
|
|
||||||
elseif intro_step==5 then
|
elseif intro_step==5 then
|
||||||
|
start_scene(scenes.intro_03,58)
|
||||||
|
intro_step=intro_step+1
|
||||||
|
elseif intro_step==6 then
|
||||||
cls(16)
|
cls(16)
|
||||||
rect(15,3,113,53,2)
|
rect(15,3,113,53,2)
|
||||||
camera(-16,-4)
|
camera(-16,-4)
|
||||||
@@ -82,14 +89,15 @@ function intro_update()
|
|||||||
rectfill(73,24,79,39,16)
|
rectfill(73,24,79,39,16)
|
||||||
sspr(0,0,16,16,44,24,16,16,false)
|
sspr(0,0,16,16,44,24,16,16,false)
|
||||||
camera(0,0)
|
camera(0,0)
|
||||||
intro_step=6
|
intro_step=intro_step+1
|
||||||
elseif intro_step==6 then
|
|
||||||
start_scene(scenes.intro_04,58)
|
|
||||||
intro_step=7
|
|
||||||
elseif intro_step==7 then
|
elseif intro_step==7 then
|
||||||
|
start_scene(scenes.intro_04,58)
|
||||||
|
intro_step=intro_step+1
|
||||||
|
elseif intro_step==8 then
|
||||||
play(audio_main_song)
|
play(audio_main_song)
|
||||||
game_init(true)
|
game_init(true)
|
||||||
|
fade.fadeoutin()
|
||||||
end
|
end
|
||||||
intro_wait=40
|
intro_wait=50
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
5
main.lua
5
main.lua
@@ -6,10 +6,11 @@ function _init()
|
|||||||
|
|
||||||
logo=newsurf(36,5)
|
logo=newsurf(36,5)
|
||||||
back=newsurf(128,96)
|
back=newsurf(128,96)
|
||||||
|
fade.init()
|
||||||
|
|
||||||
--game_init()
|
--game_init()
|
||||||
--intro_init()
|
intro_init()
|
||||||
final_init()
|
--final_init()
|
||||||
end
|
end
|
||||||
|
|
||||||
function _update() end
|
function _update() end
|
||||||
|
|||||||
11
scenes.lua
11
scenes.lua
@@ -231,7 +231,12 @@ function update_scene()
|
|||||||
scenes.die=scenes.die-1
|
scenes.die=scenes.die-1
|
||||||
if scenes.die==0 then
|
if scenes.die==0 then
|
||||||
if scenes.dnum==#scenes.current_scene then
|
if scenes.dnum==#scenes.current_scene then
|
||||||
|
if batman.endgame then
|
||||||
|
final_init()
|
||||||
|
fade.fadeoutin()
|
||||||
|
else
|
||||||
_update=old_update
|
_update=old_update
|
||||||
|
end
|
||||||
else
|
else
|
||||||
scenes.dnum=scenes.dnum+1
|
scenes.dnum=scenes.dnum+1
|
||||||
scenes.die=scenes.current_scene[scenes.dnum].die or 0
|
scenes.die=scenes.current_scene[scenes.dnum].die or 0
|
||||||
@@ -250,8 +255,12 @@ function update_scene()
|
|||||||
elseif btnp(KEY_SPACE) then
|
elseif 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
|
||||||
--freesurf(bkg)
|
if batman.endgame then
|
||||||
|
final_init()
|
||||||
|
fade.fadeoutin()
|
||||||
|
else
|
||||||
_update=old_update
|
_update=old_update
|
||||||
|
end
|
||||||
else
|
else
|
||||||
scenes.dnum=scenes.dnum+1
|
scenes.dnum=scenes.dnum+1
|
||||||
scenes.step=2
|
scenes.step=2
|
||||||
|
|||||||
Reference in New Issue
Block a user