Compare commits
3 Commits
993ddfa88e
...
f7a5cd8ca4
| Author | SHA1 | Date | |
|---|---|---|---|
| f7a5cd8ca4 | |||
| 61a666cbb3 | |||
| 77c1da8649 |
4
.gitignore
vendored
4
.gitignore
vendored
@@ -1,2 +1,4 @@
|
||||
.DS_STORE
|
||||
release/*
|
||||
release/*
|
||||
*.exe
|
||||
*.dll
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
title=Cacaus
|
||||
config=cacaus
|
||||
width=128
|
||||
height=96
|
||||
zoom=5
|
||||
|
||||
172
data/game.lua
172
data/game.lua
@@ -132,6 +132,8 @@ function game_init(menu)
|
||||
mapa_do_backup()
|
||||
|
||||
if menu then
|
||||
menu_sel=0
|
||||
menu_state=0
|
||||
abad.update = abad_nop
|
||||
game_update=update_menu
|
||||
menu_count=0
|
||||
@@ -328,23 +330,7 @@ function update_game()
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
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", 42, 12, 15)
|
||||
if menu_count<20 then
|
||||
text("Pulsa SPACE", 42, 28, 13)
|
||||
else
|
||||
text("Pulsa SPACE", 42, 28, 16)
|
||||
if menu_count>40 then menu_count=0 end
|
||||
end
|
||||
function redraw_menu_hab()
|
||||
draw_hab(menu_room,16,41)
|
||||
rectfill(0,0,14,96,16)
|
||||
rectfill(114,0,191,96,16)
|
||||
@@ -359,21 +345,147 @@ function update_menu()
|
||||
cacau.update()
|
||||
fireball.update()
|
||||
switches.update()
|
||||
end
|
||||
|
||||
if btnp(keyShoot) or padp(btnShoot) then
|
||||
game_exit()
|
||||
game_init()
|
||||
fade.fadeoutin()
|
||||
elseif btnp(KEY_M) then
|
||||
mute = not mute
|
||||
if mute then
|
||||
stopmusic()
|
||||
else
|
||||
playmus(audio_main_song)
|
||||
end
|
||||
elseif btnp(KEY_ESCAPE) then
|
||||
quit()
|
||||
function update_menu()
|
||||
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", 42, 8, 15)
|
||||
|
||||
if menu_state == 0 then
|
||||
menu_count=menu_count+1
|
||||
local parpadeig=false
|
||||
if menu_count>=20 then
|
||||
parpadeig=true
|
||||
if menu_count>40 then menu_count=0 end
|
||||
end
|
||||
if (not parpadeig or menu_sel~=0) then text("JUGAR", 54, 16, 13) end
|
||||
if (not parpadeig or menu_sel~=1) then text("REDEFINIR TECLAT", 32, 24, 13) end
|
||||
if (not parpadeig or menu_sel~=2) then text("REDEFINIR GAMEPAD", 30, 32, 13) end
|
||||
|
||||
redraw_menu_hab()
|
||||
|
||||
if btnp(keyShoot) or padp(btnShoot) then
|
||||
if menu_sel==0 then
|
||||
game_exit()
|
||||
game_init()
|
||||
fade.fadeoutin()
|
||||
elseif menu_sel==1 then
|
||||
menu_count=0
|
||||
menu_state=1
|
||||
else
|
||||
menu_count=0
|
||||
menu_state=2
|
||||
end
|
||||
elseif btnp(keyDown) or padp(btnDown) then
|
||||
menu_sel=menu_sel+1
|
||||
if menu_sel==3 then menu_sel=0 end
|
||||
elseif btnp(keyUp) or padp(btnUp) then
|
||||
menu_sel=menu_sel-1
|
||||
if menu_sel==-1 then menu_sel=2 end
|
||||
elseif btnp(KEY_M) then
|
||||
mute = not mute
|
||||
if mute then
|
||||
stopmusic()
|
||||
else
|
||||
playmus(audio_main_song)
|
||||
end
|
||||
elseif btnp(KEY_ESCAPE) then
|
||||
quit()
|
||||
end
|
||||
elseif menu_state==1 then
|
||||
if menu_count==0 then
|
||||
text("PULSA TECLA PER A AMUNT", 20, 24, 13)
|
||||
local key = btnp();
|
||||
if key ~= 0 then
|
||||
menu_count = 1
|
||||
keyUp=key
|
||||
setconf("keyup", keyUp)
|
||||
end
|
||||
elseif menu_count==1 then
|
||||
text("PULSA TECLA PER A AVALL", 20, 24, 13)
|
||||
local key = btnp();
|
||||
if key ~= 0 then
|
||||
menu_count = 2
|
||||
keyDown=key
|
||||
setconf("keydown", keyDown)
|
||||
end
|
||||
elseif menu_count==2 then
|
||||
text("PULSA TECLA PER A ESQUERRA", 14, 24, 13)
|
||||
local key = btnp();
|
||||
if key ~= 0 then
|
||||
menu_count = 3
|
||||
keyLeft=key
|
||||
setconf("keleft", keyLeft)
|
||||
end
|
||||
elseif menu_count==3 then
|
||||
text("PULSA TECLA PER A DRETA", 20, 24, 13)
|
||||
local key = btnp();
|
||||
if key ~= 0 then
|
||||
menu_count = 4
|
||||
keyRight=key
|
||||
setconf("keyright", keyRight)
|
||||
end
|
||||
elseif menu_count==4 then
|
||||
text("PULSA TECLA PER A DISPAR", 18, 24, 13)
|
||||
local key = btnp();
|
||||
if key ~= 0 then
|
||||
menu_count = 0
|
||||
menu_state = 0
|
||||
keyShoot=key
|
||||
setconf("keyshoot", keyShoot)
|
||||
end
|
||||
end
|
||||
else
|
||||
if menu_count==0 then
|
||||
text("PULSA BOTÓ PER A AMUNT", 22, 24, 13)
|
||||
local btn = padp();
|
||||
if btn ~= 0 then
|
||||
menu_count = 1
|
||||
btnUp=btn
|
||||
setconf("btnup", btnUp)
|
||||
end
|
||||
elseif menu_count==1 then
|
||||
text("PULSA BOTÓ PER A AVALL", 22, 24, 13)
|
||||
local btn = padp();
|
||||
if btn ~= 0 then
|
||||
menu_count = 2
|
||||
btnDown=btn
|
||||
setconf("btndown", btnDown)
|
||||
end
|
||||
elseif menu_count==2 then
|
||||
text("PULSA BOTÓ PER A ESQUERRA", 16, 24, 13)
|
||||
local btn = padp();
|
||||
if btn ~= 0 then
|
||||
menu_count = 3
|
||||
btnLeft=btn
|
||||
setconf("keleft", btnLeft)
|
||||
end
|
||||
elseif menu_count==3 then
|
||||
text("PULSA BOTÓ PER A DRETA", 22, 24, 13)
|
||||
local btn = padp();
|
||||
if btn ~= 0 then
|
||||
menu_count = 4
|
||||
btnRight=btn
|
||||
setconf("btnright", btnRight)
|
||||
end
|
||||
elseif menu_count==4 then
|
||||
text("PULSA BOTÓ PER A DISPAR", 20, 24, 13)
|
||||
local btn = padp();
|
||||
if btn ~= 0 then
|
||||
menu_count = 0
|
||||
menu_state = 0
|
||||
btnShoot=btn
|
||||
setconf("btnshoot", btnShoot)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function game_exit()
|
||||
|
||||
@@ -1,14 +1,3 @@
|
||||
keyUp = KEY_UP
|
||||
keyDown = KEY_DOWN
|
||||
keyLeft = KEY_LEFT
|
||||
keyRight = KEY_RIGHT
|
||||
keyShoot = KEY_SPACE
|
||||
|
||||
btnUp = BTN_UP
|
||||
btnDown = BTN_DOWN
|
||||
btnLeft = BTN_LEFT
|
||||
btnRigth = BTN_RIGHT
|
||||
btnShoot = BTN_A
|
||||
|
||||
function _init()
|
||||
tiles=loadsurf("tiles.gif")
|
||||
@@ -36,6 +25,18 @@ function _init()
|
||||
audio_hit = loadsound(audio_hit)
|
||||
audio_low = loadsound(audio_low)
|
||||
|
||||
keyUp = tonumber(getconf("keyup")) or KEY_UP
|
||||
keyDown = tonumber(getconf("keydown")) or KEY_DOWN
|
||||
keyLeft = tonumber(getconf("keyleft")) or KEY_LEFT
|
||||
keyRight = tonumber(getconf("keyright")) or KEY_RIGHT
|
||||
keyShoot = tonumber(getconf("keyshoot")) or KEY_SPACE
|
||||
|
||||
btnUp = tonumber(getconf("btnup")) or BTN_UP
|
||||
btnDown = tonumber(getconf("btndown")) or BTN_DOWN
|
||||
btnLeft = tonumber(getconf("btnleft")) or BTN_LEFT
|
||||
btnRight = tonumber(getconf("btnright")) or BTN_RIGHT
|
||||
btnShoot = tonumber(getconf("btnshoot")) or BTN_A
|
||||
|
||||
--game_init()
|
||||
intro_init()
|
||||
--final_init()
|
||||
@@ -52,5 +53,5 @@ function _update()
|
||||
cursor(fs)
|
||||
end
|
||||
|
||||
if (game_update) game_update() end
|
||||
if (game_update) then game_update() end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user