- Intro i menu
This commit is contained in:
45
game.lua
45
game.lua
@@ -1,7 +1,8 @@
|
||||
--hab=0
|
||||
|
||||
modes={playing=0,editing=1}
|
||||
mode=modes.editing
|
||||
--mode=modes.editing
|
||||
mode=modes.playing
|
||||
|
||||
seltile = 0
|
||||
|
||||
@@ -101,8 +102,14 @@ function game_init(menu)
|
||||
table.insert(cameras,elalien)
|
||||
table.insert(cameras,batman)
|
||||
|
||||
mapa_do_backup()
|
||||
|
||||
if menu then
|
||||
abad.update = abad_nop
|
||||
_update=update_menu
|
||||
menu_count=0
|
||||
menu_change_room=300
|
||||
menu_room=rnd(60)
|
||||
else
|
||||
_update=update_game
|
||||
end
|
||||
@@ -182,7 +189,7 @@ function update_game()
|
||||
abad.hab=abad.hab-10
|
||||
elseif btnp(KEY_RETURN) then
|
||||
mode=modes.playing
|
||||
mapa_do_backup()
|
||||
--mapa_do_backup()
|
||||
--playchirp(audio_main_song);
|
||||
elseif btnp(KEY_S) and (btn(KEY_LCTRL) or btn(KEY_LGUI)) then
|
||||
_update=update_dialog
|
||||
@@ -286,13 +293,28 @@ function update_game()
|
||||
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
|
||||
actor:update()
|
||||
@@ -302,12 +324,15 @@ function update_menu()
|
||||
cacau.update()
|
||||
fireball.update()
|
||||
switches.update()
|
||||
|
||||
|
||||
if btn(KEY_SPACE) then
|
||||
game_exit()
|
||||
game_init()
|
||||
end
|
||||
end
|
||||
|
||||
function game_exit()
|
||||
mapa_restore_backup()
|
||||
--freesurf(tiles)
|
||||
actors={}
|
||||
cameras={}
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user