10 Commits

Author SHA1 Message Date
17654b2c82 - Modificat per a funcionar en l'ultima versió de mini (v0.9.80) 2023-08-31 23:43:56 +02:00
a3ca7bec86 - Ara es pot usar el gamepad per a tot 2023-02-10 19:06:26 +01:00
5c3e01d3e4 Batman position gets reseted on new game 2023-01-21 17:22:37 +01:00
9a4f41541f - Ignore binaries in folder 2023-01-21 14:32:08 +01:00
3898289f57 - Now Up and Jump can be defined as different keys/buttons. 2023-01-21 14:29:50 +01:00
33af343c80 - version change in Info.plist
- ESC exits from keys or pad redefine state.
2023-01-21 14:06:57 +01:00
dba989ca24 - [FIX] Gamepad redefine was not working correctly
- [FIX] ESC can't be reassigned
- [NEW] cursor keys, space, cursor pad and button A can always be used to move around menus.
2023-01-20 20:08:10 +01:00
f7a5cd8ca4 - [FEAT] Redefine keys
- [FEAT] Redefine gamepad buttons
- [FEAT] Config storage
2023-01-20 19:58:15 +01:00
61a666cbb3 - Git should ignore exes and dlls 2023-01-20 19:27:46 +01:00
77c1da8649 - Reorder code
- [FIX] game_update() not being called
2023-01-20 19:26:57 +01:00
10 changed files with 307 additions and 71 deletions

6
.gitignore vendored
View File

@@ -1,2 +1,6 @@
.DS_STORE
release/*
release/*
*.exe
*.dll
mini
mini_debug

View File

@@ -23,11 +23,11 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0.8</string>
<string>1.1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0.8</string>
<string>1.1.0</string>
<key>CSResourcesFileMapped</key>
<true/>
<key>LSMinimumSystemVersion</key>
@@ -41,4 +41,4 @@
<key>SUPublicDSAKeyFile</key>
<string>dsa_pub.pem</string>
</dict>
</plist>
</plist>

View File

@@ -1,4 +1,6 @@
require "dead"
abad={x=40,y=24,flip=false,frame=1,wait=0,respawning=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()
@@ -87,7 +89,7 @@ function abad_state_normal()
elseif btn(keyLeft) or pad(btnLeft) then
abad.update=abad_state_walking
abad.flip=true
elseif btn(keyUp) or pad(btnUp) then
elseif btn(keyJump) or pad(btnJump) then
abad.update=abad_state_jumping
abad.step=0
abad.jumpfwd=false
@@ -185,7 +187,7 @@ function abad_state_walking()
abad_make_safe()
if btn(keyUp) or pad(btnUp) then
if btn(keyJump) or pad(btnJump) then
abad.update=abad_state_jumping
abad.step=0
abad.jumpfwd=true

View File

@@ -6,6 +6,8 @@ function batman.init()
batman.draw=batman.draw
local habs={5,9,46,36,18}
batman.hab=habs[1+rnd(#habs)]
batman.x=24
batman.y=24
end
function batman.draw()

View File

@@ -1,4 +1,5 @@
title=Cacaus
config=cacaus
width=128
height=96
zoom=5

View File

@@ -1,4 +1,22 @@
--hab=0
require "abad"
require "gps"
require "gorro"
require "peu"
require "premiere"
require "elalien"
require "batman"
require "bol"
require "gota"
require "invisibl"
require "zombie"
require "caco"
require "trigger"
require "score"
require "imp"
require "bambolla"
require "cacau"
require "fireball"
require "switches"
modes={playing=0,editing=1}
--mode=modes.editing
@@ -132,6 +150,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
@@ -145,20 +165,6 @@ function game_init(menu)
--fade.fadein()
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)
@@ -309,7 +315,7 @@ function update_game()
--elseif btnp(KEY_ESCAPE) then
-- pause()
--end
if btnp(KEY_ESCAPE) then
if btnp(KEY_ESCAPE) or padp(btnPause) then
pause()
end
if abad.objects.gps~=nil then
@@ -324,27 +330,22 @@ function update_game()
elseif btnp(KEY_5) then
current_camera=5
end
if padp(btnCycle1) then
current_camera=current_camera+1
if current_camera==6 then current_camera=1 end
if current_camera==1 and (abad.objects.gorro or abad.objects.clau_premiere) then current_camera=2 end
if current_camera==2 and (abad.objects.peu or abad.objects.clau_elalien) then current_camera=3 end
elseif padp(btnCycle2) then
current_camera=current_camera-1
if current_camera==0 then current_camera=5 end
if current_camera==2 and (abad.objects.peu or abad.objects.clau_elalien) then current_camera=1 end
if current_camera==1 and (abad.objects.gorro or abad.objects.clau_premiere) then current_camera=5 end
end
end
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 +360,171 @@ 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 btnp(KEY_SPACE) or padp(BTN_A) 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 btnp(KEY_DOWN) or padp(BTN_DOWN) or padp(btnDown) then
menu_sel=menu_sel+1
if menu_sel==3 then menu_sel=0 end
elseif btnp(keyUp) or btnp(KEY_UP) or padp(BTN_UP) 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) or padp(btnPause) then
quit()
end
elseif menu_state==1 then
if btnp(KEY_ESCAPE) then
menu_count = 0
menu_state = 0
end
if menu_count==0 then
text("PULSA TECLA PER A AMUNT", 20, 24, 13)
local key = btnp();
if key ~= 0 and key~=KEY_ESCAPE 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 and key~=KEY_ESCAPE 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 and key~=KEY_ESCAPE 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 and key~=KEY_ESCAPE then
menu_count = 4
keyRight=key
setconf("keyright", keyRight)
end
elseif menu_count==4 then
text("PULSA TECLA PER A BOTAR", 20, 24, 13)
local key = btnp();
if key ~= 0 and key~=KEY_ESCAPE then
menu_count = 5
keyJump=key
setconf("keyjump", keyJump)
end
elseif menu_count==5 then
text("PULSA TECLA PER A DISPAR", 18, 24, 13)
local key = btnp();
if key ~= 0 and key~=KEY_ESCAPE then
menu_count = 0
menu_state = 0
keyShoot=key
setconf("keyshoot", keyShoot)
end
end
else
if btnp(KEY_ESCAPE) then
menu_count = 0
menu_state = 0
end
if menu_count==0 then
text("PULSA BOTÓ PER A AMUNT", 22, 24, 13)
local btn = padp();
if btn ~= -1 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 ~= -1 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 ~= -1 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 ~= -1 then
menu_count = 4
btnRight=btn
setconf("btnright", btnRight)
end
elseif menu_count==4 then
text("PULSA BOTÓ PER A BOTAR", 22, 24, 13)
local btn = padp();
if btn ~= -1 then
menu_count = 5
btnJump=btn
setconf("btnjump", btnJump)
end
elseif menu_count==5 then
text("PULSA BOTÓ PER A DISPAR", 20, 24, 13)
local btn = padp();
if btn ~= -1 then
menu_count = 0
menu_state = 0
btnShoot=btn
setconf("btnshoot", btnShoot)
end
end
end
end
function game_exit()
@@ -392,6 +543,7 @@ function pause()
sspr(0,0,128,96,0,0)
setdest(0)
setsource(tiles)
pausa_option=1
pause_old_update=game_update
game_update=update_pause
end
@@ -400,16 +552,30 @@ function update_pause()
rectfill(16,16,112,80,16)
rect(16,16,112,80,15)
prnt("PAUSA",54,30,15)
prnt("ESC torna al joc",30,50,14)
prnt("SPACE eixir",30,60,14)
if pausa_option==1 then
rect(28,48,100,56,13)
else
rect(28,58,100,66,13)
end
prnt("CONTINUAR",30,50,14)
prnt("EIXIR",30,60,14)
if btnp(KEY_ESCAPE) then
setsource(back)
sspr(0,0,128,96,0,0)
setsource(tiles)
game_update = pause_old_update
elseif btnp(keyDown) or btnp(keyUp) or padp(btnDown) or padp(btnUp) then
if pausa_option==1 then pausa_option=2 else pausa_option=1 end
elseif btnp(keyShoot) or padp(btnShoot) then
game_exit()
game_init(true)
if pausa_option==1 then
setsource(back)
sspr(0,0,128,96,0,0)
setsource(tiles)
game_update = pause_old_update
else
game_exit()
game_init(true)
end
end
end

View File

@@ -1,3 +1,8 @@
require "fade"
require "game"
require "mapa"
require "scenes"
intro_wait=40
intro_step=0
@@ -19,7 +24,7 @@ function intro_intro()
--text("JAILGAMES",40,30,15)
text("presenta",48,50,14)
intro_wait=intro_wait-1
if intro_wait==0 or btnp(KEY_ESCAPE) or btnp(keyShoot) or padp(btnShoot) then
if intro_wait==0 or btnp(KEY_ESCAPE) or btnp(keyShoot) or padp(btnShoot) or padp(btnPause) then
intro_wait=1
game_update = intro_update
fade.fadeoutin()
@@ -30,7 +35,7 @@ function intro_intro()
end
function intro_update()
if btnp(KEY_ESCAPE) then
if btnp(KEY_ESCAPE) or padp(btnPause) then
game_init(true)
fade.fadeoutin()
elseif btnp(KEY_SPACE) then

View File

@@ -1,14 +1,35 @@
keyUp = KEY_UP
keyDown = KEY_DOWN
keyLeft = KEY_LEFT
keyRight = KEY_RIGHT
keyShoot = KEY_SPACE
require "final"
require "fade"
require "audio"
require "dead"
require "scenes"
require "trigger"
require "score"
require "switches"
require "map"
require "mapa"
require "bol"
require "invisibl"
require "gota"
require "fireball"
require "cacau"
require "bambolla"
require "imp"
require "gps"
require "peu"
require "gorro"
require "batman"
require "elalien"
require "premiere"
require "caco"
require "zombie"
require "abad"
require "intro"
require "game"
btnUp = BTN_UP
btnDown = BTN_DOWN
btnLeft = BTN_LEFT
btnRigth = BTN_RIGHT
btnShoot = BTN_A
--require "fade"
--require "audio"
--require "intro"
function _init()
tiles=loadsurf("tiles.gif")
@@ -36,6 +57,23 @@ 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
keyJump = tonumber(getconf("keyjump")) or KEY_UP
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
btnJump = tonumber(getconf("btnjump")) or BTN_B
btnShoot = tonumber(getconf("btnshoot")) or BTN_A
btnCycle1 = tonumber(getconf("btnCycle1")) or BTN_RIGHTSHOULDER
btnCycle2 = tonumber(getconf("btnCycle2")) or BTN_LEFTSHOULDER
btnPause = tonumber(getconf("btnPause")) or BTN_START
--game_init()
intro_init()
--final_init()
@@ -52,5 +90,19 @@ function _update()
cursor(fs)
end
if (game_update) game_update() end
if (game_update) then game_update() end
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

View File

@@ -1,4 +1,5 @@
--mapa={}
require "map"
tiletype={void=0,nonpc=1,stair=2,switch=3,half=4,block=5}
mapa.wait=0
mapa.step=0

View File

@@ -1,3 +1,6 @@
require "final"
require "audio"
scenes={
intro_01= {
{x=3,y=0,flip=false,audio="abad",text={"Ah!, què bo!","Nit de Netflix amb","un bon bol de cacaus!"},die=20},
@@ -272,7 +275,7 @@ function update_scene()
end
end
if btnp(KEY_ESCAPE) and (scenes.current_scene~=scenes.final) then
if (btnp(KEY_ESCAPE) or padp(btnPause)) and (scenes.current_scene~=scenes.final) then
if scenes.current_scene[scenes.dnum].die then
game_init(true)
else