- Intro i menu

This commit is contained in:
2022-12-28 16:40:36 +01:00
parent 1d2e65d93f
commit b756186984
4 changed files with 43 additions and 14 deletions

View File

@@ -1,6 +1,9 @@
abad={x=40,y=24,flip=false,frame=1,wait=0,hab=10,vides=3,energia=40,falling=0,step=0, mustep=1,hurting=0,update=nil,jumpfwd=false,anim={0,1,0,2},bb={x=4,y=0,w=8,h=16},safe={hab=10,x=40,y=24}} abad={x=40,y=24,flip=false,frame=1,wait=0,hab=10,vides=3,energia=40,falling=0,step=0, mustep=1,hurting=0,update=nil,jumpfwd=false,anim={0,1,0,2},bb={x=4,y=0,w=8,h=16},safe={hab=10,x=40,y=24}}
function abad_nop()
end
function abad_init() function abad_init()
abad={x=40,y=24,flip=false,frame=1,wait=0,hab=10,vides=3,energia=40,falling=0,step=0,mustep=1,draw=abad.draw,hurting=0,update=nil,jumpfwd=false,anim={0,1,0,2},bb={x=4,y=0,w=8,h=16},safe={hab=10,x=40,y=24}} abad={x=40,y=24,flip=false,frame=1,wait=0,hab=10,vides=3,energia=40,falling=0,step=0,mustep=1,draw=abad.draw,hurting=0,update=nil,jumpfwd=false,anim={0,1,0,2},bb={x=4,y=0,w=8,h=16},safe={hab=10,x=40,y=24}}
abad.update=abad_state_normal abad.update=abad_state_normal

View File

@@ -41,7 +41,8 @@ function dead.update()
if (dead.count>250 and btnp(KEY_SPACE)) or dead.count>500 then if (dead.count>250 and btnp(KEY_SPACE)) or dead.count>500 then
game_exit() game_exit()
_init() game_init()
_update=update_game --_init()
--_update=update_game
end end
end end

View File

@@ -1,7 +1,8 @@
--hab=0 --hab=0
modes={playing=0,editing=1} modes={playing=0,editing=1}
mode=modes.editing --mode=modes.editing
mode=modes.playing
seltile = 0 seltile = 0
@@ -101,8 +102,14 @@ function game_init(menu)
table.insert(cameras,elalien) table.insert(cameras,elalien)
table.insert(cameras,batman) table.insert(cameras,batman)
mapa_do_backup()
if menu then if menu then
abad.update = abad_nop
_update=update_menu _update=update_menu
menu_count=0
menu_change_room=300
menu_room=rnd(60)
else else
_update=update_game _update=update_game
end end
@@ -182,7 +189,7 @@ function update_game()
abad.hab=abad.hab-10 abad.hab=abad.hab-10
elseif btnp(KEY_RETURN) then elseif btnp(KEY_RETURN) then
mode=modes.playing mode=modes.playing
mapa_do_backup() --mapa_do_backup()
--playchirp(audio_main_song); --playchirp(audio_main_song);
elseif btnp(KEY_S) and (btn(KEY_LCTRL) or btn(KEY_LGUI)) then elseif btnp(KEY_S) and (btn(KEY_LCTRL) or btn(KEY_LGUI)) then
_update=update_dialog _update=update_dialog
@@ -286,13 +293,28 @@ function update_game()
end end
end end
function update_menu()
cls(16)
text("C A C A U S", 40, 14, 15)
rect(15,44,113,93,2)
draw_hab(cameras[current_camera].hab,16,45)
mapa_update(abad.hab,cameras[current_camera].hab) function update_menu()
menu_count=menu_count+1
menu_change_room=menu_change_room-1
if menu_change_room==0 then
menu_room = rnd(60)
menu_change_room=300
end
cls(16)
text("C A C A U S", 40, 12, 15)
if menu_count<20 then
text("Pulsa SPACE", 40, 28, 13)
else
text("Pulsa SPACE", 40, 28, 16)
if menu_count>40 then menu_count=0 end
end
draw_hab(menu_room,16,41)
rectfill(0,0,14,96,16)
rectfill(114,0,191,96,16)
rect(15,40,113,89,2)
mapa_update(abad.hab,menu_room)
for key,actor in pairs(actors) do for key,actor in pairs(actors) do
actor:update() actor:update()
@@ -302,12 +324,15 @@ function update_menu()
cacau.update() cacau.update()
fireball.update() fireball.update()
switches.update() switches.update()
if btn(KEY_SPACE) then
game_exit()
game_init()
end
end end
function game_exit() function game_exit()
mapa_restore_backup() mapa_restore_backup()
--freesurf(tiles)
actors={} actors={}
cameras={} cameras={}
end end

View File

@@ -13,8 +13,8 @@ function intro_init()
end end
function intro_update() function intro_update()
playchirp(audio_main_song) --playchirp(audio_main_song)
game_init(true) --game_init(true)
intro_wait=intro_wait-1 intro_wait=intro_wait-1
if intro_wait==0 then if intro_wait==0 then