15 Commits
v1.0 ... v1.1.1

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
993ddfa88e - Exit from "menu" with ESCAPE 2023-01-20 19:18:03 +01:00
c126ce5f4a - Cursor hidden on fullscreen 2023-01-20 19:16:35 +01:00
db9ce7898b - Icon resource for Windows added
- Zoom and fullscreen controlled from Lua
- Basic gamepad support
2023-01-20 19:14:59 +01:00
0b2f30bac8 - Windows icon added 2023-01-13 19:45:59 +01:00
e11d869dc2 - Ignore release files 2023-01-13 19:43:43 +01:00
17 changed files with 368 additions and 117 deletions

5
.gitignore vendored
View File

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

View File

@@ -23,11 +23,11 @@
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>APPL</string> <string>APPL</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>1.0.8</string> <string>1.1.0</string>
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>????</string> <string>????</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>1.0.8</string> <string>1.1.0</string>
<key>CSResourcesFileMapped</key> <key>CSResourcesFileMapped</key>
<true/> <true/>
<key>LSMinimumSystemVersion</key> <key>LSMinimumSystemVersion</key>

BIN
bin/cacaus.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 KiB

1
bin/icon.rc Normal file
View File

@@ -0,0 +1 @@
id ICON "cacaus.ico"

BIN
bin/icon.res Normal file

Binary file not shown.

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}} 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() function abad_nop()
@@ -81,13 +83,13 @@ function abad_state_normal()
end end
abad_make_safe() abad_make_safe()
if btn(KEY_RIGHT) then if btn(keyRight) or pad(btnRight) then
abad.update=abad_state_walking abad.update=abad_state_walking
abad.flip=false abad.flip=false
elseif btn(KEY_LEFT) then elseif btn(keyLeft) or pad(btnLeft) then
abad.update=abad_state_walking abad.update=abad_state_walking
abad.flip=true abad.flip=true
elseif btn(KEY_UP) then elseif btn(keyJump) or pad(btnJump) then
abad.update=abad_state_jumping abad.update=abad_state_jumping
abad.step=0 abad.step=0
abad.jumpfwd=false abad.jumpfwd=false
@@ -96,11 +98,11 @@ function abad_state_normal()
abad.jump=nil abad.jump=nil
end end
playsnd(audio_abad_jump) playsnd(audio_abad_jump)
elseif btn(KEY_DOWN) then elseif btn(keyDown) or pad(btnDown) then
abad.update=abad_state_crouch abad.update=abad_state_crouch
elseif btn(KEY_Z) then --elseif btn(KEY_Z) then
abad.respawning=240 -- abad.respawning=240
elseif btnp(KEY_SPACE) and cacau.hab==-1 then elseif btn(keyShoot) or pad(btnShoot) and cacau.hab==-1 then
playsnd(audio_abad_shot) playsnd(audio_abad_shot)
abad.update=abad_state_fire abad.update=abad_state_fire
abad.wait=0 abad.wait=0
@@ -116,7 +118,7 @@ function abad_state_crouch()
abad.step=0 abad.step=0
abad.jumpfwd=false abad.jumpfwd=false
if not btn(KEY_DOWN) then if not (btn(keyDown) or pad(btnDown)) then
abad.update=abad_state_normal abad.update=abad_state_normal
abad.bb.y=0 abad.bb.y=0
abad.bb.h=16 abad.bb.h=16
@@ -185,7 +187,7 @@ function abad_state_walking()
abad_make_safe() abad_make_safe()
if btn(KEY_UP) then if btn(keyJump) or pad(btnJump) then
abad.update=abad_state_jumping abad.update=abad_state_jumping
abad.step=0 abad.step=0
abad.jumpfwd=true abad.jumpfwd=true
@@ -195,18 +197,18 @@ function abad_state_walking()
end end
playsnd(audio_abad_jump) playsnd(audio_abad_jump)
return return
elseif btn(KEY_DOWN) then elseif btn(keyDown) or pad(btnDown) then
abad.update=abad_state_crouch abad.update=abad_state_crouch
elseif btn(KEY_SPACE) and cacau.hab==-1 then elseif btn(keyShoot) or pad(btnShoot) and cacau.hab==-1 then
playsnd(audio_abad_shot) playsnd(audio_abad_shot)
abad.update=abad_state_fire abad.update=abad_state_fire
abad.wait=0 abad.wait=0
cacau.init(abad.hab,abad.x+8,abad.y+8,abad.flip) cacau.init(abad.hab,abad.x+8,abad.y+8,abad.flip)
end end
if btn(KEY_RIGHT) then if btn(keyRight) or pad(btnRight) then
abad.flip=false abad.flip=false
elseif btn(KEY_LEFT) then elseif btn(keyLeft) or pad(btnLeft) then
abad.flip=true abad.flip=true
elseif abad.wait==0 then elseif abad.wait==0 then
abad.update=abad_state_normal abad.update=abad_state_normal
@@ -297,15 +299,15 @@ function abad_state_stairs()
if abad.wait==6 then if abad.wait==6 then
abad.wait=0 abad.wait=0
if btn(KEY_RIGHT) then if btn(keyRight) or pad(btnRight) then
abad.flip=false abad.flip=false
abad_advance() abad_advance()
playsnd(audio_low) playsnd(audio_low)
elseif btn(KEY_LEFT) then elseif btn(keyLeft) or pad(btnLeft) then
abad.flip=true abad.flip=true
abad_advance() abad_advance()
playsnd(audio_low) playsnd(audio_low)
elseif btn(KEY_UP) then elseif btn(keyUp) or pad(btnUp) then
if abad.y>0 then if abad.y>0 then
if check_tile(abad.hab,abad.x+4,abad.y+8)==tiletype.stair or (abad.x+4)&7~=0 and check_tile(abad.hab,abad.x+12,abad.y+8)==tiletype.stair then if check_tile(abad.hab,abad.x+4,abad.y+8)==tiletype.stair or (abad.x+4)&7~=0 and check_tile(abad.hab,abad.x+12,abad.y+8)==tiletype.stair then
abad.y=abad.y-2 abad.y=abad.y-2
@@ -316,7 +318,7 @@ function abad_state_stairs()
imp.reset() imp.reset()
abad.y=32 abad.y=32
end end
elseif btn(KEY_DOWN) then elseif btn(keyDown) or pad(btnDown) then
if abad.y<32 then if abad.y<32 then
if check_tile(abad.hab,abad.x+4,abad.y+16)==tiletype.stair or (abad.x+4)&7~=0 and check_tile(abad.hab,abad.x+12,abad.y+16)==tiletype.stair then if check_tile(abad.hab,abad.x+4,abad.y+16)==tiletype.stair or (abad.x+4)&7~=0 and check_tile(abad.hab,abad.x+12,abad.y+16)==tiletype.stair then
abad.y=abad.y+2 abad.y=abad.y+2

View File

@@ -6,6 +6,8 @@ function batman.init()
batman.draw=batman.draw batman.draw=batman.draw
local habs={5,9,46,36,18} local habs={5,9,46,36,18}
batman.hab=habs[1+rnd(#habs)] batman.hab=habs[1+rnd(#habs)]
batman.x=24
batman.y=24
end end
function batman.draw() function batman.draw()
@@ -213,12 +215,6 @@ function batman.update_stairs()
if batman.wait>=6 then if batman.wait>=6 then
batman.wait=0 batman.wait=0
--if btn(KEY_RIGHT) then
-- batman.flip=false
-- batman_advance()
--elseif btn(KEY_LEFT) then
-- batman.flip=true
-- batman_advance()
if batman.goup then if batman.goup then
if batman.y>0 then if batman.y>0 then
if check_tile(batman.hab,batman.x+4,batman.y+8)==tiletype.stair or (batman.x+4)&7~=0 and check_tile(batman.hab,batman.x+12,batman.y+8)==tiletype.stair then if check_tile(batman.hab,batman.x+4,batman.y+8)==tiletype.stair or (batman.x+4)&7~=0 and check_tile(batman.hab,batman.x+12,batman.y+8)==tiletype.stair then

View File

@@ -8,7 +8,7 @@ function dead.start()
dead.pos[i]=0 dead.pos[i]=0
dead.vel[i]=(200+rnd(400))/400 dead.vel[i]=(200+rnd(400))/400
end end
_update=dead.update game_update=dead.update
end end
function dead.update() function dead.update()
@@ -39,10 +39,8 @@ function dead.update()
end end
end end
if (dead.count>250 and btnp(KEY_SPACE)) or dead.count>500 then if (dead.count>250 and (btnp(keyShoot) or padp(btnShoot))) or dead.count>500 then
game_exit() game_exit()
game_init(true) game_init(true)
--_init()
--_update=update_game
end end
end end

View File

@@ -223,12 +223,6 @@ function elalien.update_stairs()
if elalien.wait>=6 then if elalien.wait>=6 then
elalien.wait=0 elalien.wait=0
--if btn(KEY_RIGHT) then
-- elalien.flip=false
-- elalien_advance()
--elseif btn(KEY_LEFT) then
-- elalien.flip=true
-- elalien_advance()
if elalien.goup then if elalien.goup then
if elalien.y>0 then if elalien.y>0 then
if check_tile(elalien.hab,elalien.x+4,elalien.y+8)==tiletype.stair or (elalien.x+4)&7~=0 and check_tile(elalien.hab,elalien.x+12,elalien.y+8)==tiletype.stair then if check_tile(elalien.hab,elalien.x+4,elalien.y+8)==tiletype.stair or (elalien.x+4)&7~=0 and check_tile(elalien.hab,elalien.x+12,elalien.y+8)==tiletype.stair then

View File

@@ -24,16 +24,16 @@ fade = {
fadeout = function() fadeout = function()
--print("fading out") --print("fading out")
fade.old_update=_update fade.old_update=game_update
_update=fade.update_fadeout game_update=fade.update_fadeout
fade.wait=0 fade.wait=0
fade.step=0 fade.step=0
end, end,
fadeoutin = function() fadeoutin = function()
--print("fading outin") --print("fading outin")
fade.old_update=_update fade.old_update=game_update
_update=fade.update_fadeout game_update=fade.update_fadeout
fade.wait=0 fade.wait=0
fade.step=0 fade.step=0
fade.outin=true fade.outin=true
@@ -55,7 +55,7 @@ fade = {
end end
fade.step=fade.step+1 fade.step=fade.step+1
if fade.step==7 then if fade.step==7 then
_update = fade.old_update game_update = fade.old_update
if fade.outin then if fade.outin then
fade.outin=false; fade.outin=false;
fade.fadein() fade.fadein()
@@ -66,8 +66,8 @@ fade = {
fadein = function() fadein = function()
--print("fading in") --print("fading in")
fade.old_update=_update fade.old_update=game_update
_update=fade.update_fadein game_update=fade.update_fadein
fade.wait=0 fade.wait=0
fade.step=6 fade.step=6
for i=1,15 do setcolor(i,0,0,0) end for i=1,15 do setcolor(i,0,0,0) end
@@ -91,7 +91,7 @@ fade = {
end end
fade.step=fade.step-1 fade.step=fade.step-1
if fade.step<0 then if fade.step<0 then
_update = fade.old_update game_update = fade.old_update
end end
end end
end end

View File

@@ -6,7 +6,7 @@ function final_init()
current_actor=1 current_actor=1
abad.update = abad_nop abad.update = abad_nop
_update=update_final game_update=update_final
next_actor() next_actor()
playmus(audio_final) playmus(audio_final)
local r,g,b=getcolor(15) local r,g,b=getcolor(15)
@@ -128,7 +128,7 @@ function next_actor()
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 elseif current_actor==14 then
final_count=0 final_count=0
_update=update_final2 game_update=update_final2
fade.fadeoutin() fade.fadeoutin()
end end
final_room=final_rooms[current_actor] final_room=final_rooms[current_actor]
@@ -150,7 +150,7 @@ function update_final2()
end end
end end
final_count=final_count+1 final_count=final_count+1
if final_count==200 or btnp(KEY_SPACE) or btnp(KEY_RETURN) then if final_count==200 or (btnp(keyShoot) or padp(btnShoot)) or btnp(KEY_RETURN) then
game_exit() game_exit()
game_init(true) game_init(true)
fade.fadeoutin() fade.fadeoutin()

View File

@@ -1,4 +1,5 @@
title=Cacaus title=Cacaus
config=cacaus
width=128 width=128
height=96 height=96
zoom=5 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} modes={playing=0,editing=1}
--mode=modes.editing --mode=modes.editing
@@ -132,33 +150,21 @@ function game_init(menu)
mapa_do_backup() mapa_do_backup()
if menu then if menu then
menu_sel=0
menu_state=0
abad.update = abad_nop abad.update = abad_nop
_update=update_menu game_update=update_menu
menu_count=0 menu_count=0
menu_change_room=300 menu_change_room=300
menu_room=rnd(60) menu_room=rnd(60)
playmus(audio_main_song) playmus(audio_main_song)
else else
_update=update_game game_update=update_game
stopmusic() stopmusic()
end end
--fade.fadein() --fade.fadein()
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
function draw_hab(hab,x,y,editing) function draw_hab(hab,x,y,editing)
camera(-x,-y) camera(-x,-y)
mapa_draw(hab) mapa_draw(hab)
@@ -185,10 +191,10 @@ function update_dialog()
text("(Y)es (N)o",25,40,2) text("(Y)es (N)o",25,40,2)
if btnp(KEY_N) then if btnp(KEY_N) then
_update=update_game game_update=update_game
elseif btnp(KEY_Y) then elseif btnp(KEY_Y) then
mapa_save() mapa_save()
_update=update_game game_update=update_game
end end
end end
@@ -220,7 +226,7 @@ function update_game()
elseif btnp(KEY_RETURN) then elseif btnp(KEY_RETURN) then
mode=modes.playing mode=modes.playing
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 game_update=update_dialog
elseif btnp(KEY_C) then elseif btnp(KEY_C) then
mapa_cycle_colors(abad.hab) mapa_cycle_colors(abad.hab)
elseif btnp(KEY_M) then elseif btnp(KEY_M) then
@@ -309,7 +315,7 @@ function update_game()
--elseif btnp(KEY_ESCAPE) then --elseif btnp(KEY_ESCAPE) then
-- pause() -- pause()
--end --end
if btnp(KEY_ESCAPE) then if btnp(KEY_ESCAPE) or padp(btnPause) then
pause() pause()
end end
if abad.objects.gps~=nil then if abad.objects.gps~=nil then
@@ -324,27 +330,22 @@ function update_game()
elseif btnp(KEY_5) then elseif btnp(KEY_5) then
current_camera=5 current_camera=5
end 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 end
end end
function redraw_menu_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", 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
draw_hab(menu_room,16,41) draw_hab(menu_room,16,41)
rectfill(0,0,14,96,16) rectfill(0,0,14,96,16)
rectfill(114,0,191,96,16) rectfill(114,0,191,96,16)
@@ -359,11 +360,49 @@ function update_menu()
cacau.update() cacau.update()
fireball.update() fireball.update()
switches.update() switches.update()
end
if btnp(KEY_SPACE) then 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_exit()
game_init() game_init()
fade.fadeoutin() 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 elseif btnp(KEY_M) then
mute = not mute mute = not mute
if mute then if mute then
@@ -371,7 +410,121 @@ function update_menu()
else else
playmus(audio_main_song) playmus(audio_main_song)
end end
elseif btnp(KEY_ESCAPE) or padp(btnPause) then
quit()
end 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 end
function game_exit() function game_exit()
@@ -390,24 +543,39 @@ function pause()
sspr(0,0,128,96,0,0) sspr(0,0,128,96,0,0)
setdest(0) setdest(0)
setsource(tiles) setsource(tiles)
pause_old_update=_update pausa_option=1
_update=update_pause pause_old_update=game_update
game_update=update_pause
end end
function update_pause() function update_pause()
rectfill(16,16,112,80,16) rectfill(16,16,112,80,16)
rect(16,16,112,80,15) rect(16,16,112,80,15)
prnt("PAUSA",54,30,15) prnt("PAUSA",54,30,15)
prnt("ESC torna al joc",30,50,14) if pausa_option==1 then
prnt("SPACE eixir",30,60,14) 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 if btnp(KEY_ESCAPE) then
setsource(back) setsource(back)
sspr(0,0,128,96,0,0) sspr(0,0,128,96,0,0)
setsource(tiles) setsource(tiles)
_update = pause_old_update game_update = pause_old_update
elseif btnp(KEY_SPACE) then 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
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_exit()
game_init(true) game_init(true)
end end
end end
end

View File

@@ -1,8 +1,13 @@
require "fade"
require "game"
require "mapa"
require "scenes"
intro_wait=40 intro_wait=40
intro_step=0 intro_step=0
function intro_init() function intro_init()
_update = intro_intro game_update = intro_intro
intro_wait=400 intro_wait=400
cls(16) cls(16)
setdest(logo) setdest(logo)
@@ -19,9 +24,9 @@ function intro_intro()
--text("JAILGAMES",40,30,15) --text("JAILGAMES",40,30,15)
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(keyShoot) or padp(btnShoot) or padp(btnPause) then
intro_wait=1 intro_wait=1
_update = intro_update game_update = intro_update
fade.fadeoutin() fade.fadeoutin()
end end
if btnp(KEY_M) then if btnp(KEY_M) then
@@ -30,7 +35,7 @@ function intro_intro()
end end
function intro_update() function intro_update()
if btnp(KEY_ESCAPE) then if btnp(KEY_ESCAPE) or padp(btnPause) then
game_init(true) game_init(true)
fade.fadeoutin() fade.fadeoutin()
elseif btnp(KEY_SPACE) then elseif btnp(KEY_SPACE) then

View File

@@ -1,3 +1,36 @@
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"
--require "fade"
--require "audio"
--require "intro"
function _init() function _init()
tiles=loadsurf("tiles.gif") tiles=loadsurf("tiles.gif")
setsource(tiles) setsource(tiles)
@@ -24,9 +57,52 @@ function _init()
audio_hit = loadsound(audio_hit) audio_hit = loadsound(audio_hit)
audio_low = loadsound(audio_low) 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() --game_init()
intro_init() intro_init()
--final_init() --final_init()
end end
function _update() end function _update()
if btnp(KEY_F2) then
local val = zoom() + 2
if val >= 10 then val = 2 end
zoom(val)
elseif btnp(KEY_F3) then
local fs = fullscreen()
fullscreen(not fs)
cursor(fs)
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} tiletype={void=0,nonpc=1,stair=2,switch=3,half=4,block=5}
mapa.wait=0 mapa.wait=0
mapa.step=0 mapa.step=0
@@ -162,7 +163,7 @@ function mapa_create_minimap()
end end
end end
end end
_update=mapa_draw_minimap game_update=mapa_draw_minimap
end end
function mapa_draw_minimap() function mapa_draw_minimap()

View File

@@ -1,3 +1,6 @@
require "final"
require "audio"
scenes={ scenes={
intro_01= { 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}, {x=3,y=0,flip=false,audio="abad",text={"Ah!, què bo!","Nit de Netflix amb","un bon bol de cacaus!"},die=20},
@@ -144,8 +147,8 @@ function start_scene(scene,offset)
playmus(scenes.current_scene[scenes.dnum].musica) playmus(scenes.current_scene[scenes.dnum].musica)
end end
if offset then scenes.offset=offset end if offset then scenes.offset=offset end
old_update=_update old_update=game_update
_update=update_scene game_update=update_scene
end end
function playtext(snd) function playtext(snd)
@@ -254,7 +257,7 @@ function update_scene()
final_init() final_init()
fade.fadeoutin() fade.fadeoutin()
else else
_update=old_update game_update=old_update
end end
else else
scenes.dnum=scenes.dnum+1 scenes.dnum=scenes.dnum+1
@@ -272,7 +275,7 @@ function update_scene()
end end
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 if scenes.current_scene[scenes.dnum].die then
game_init(true) game_init(true)
else else
@@ -283,21 +286,22 @@ function update_scene()
end end
if scenes.step>8 then if scenes.step>8 then
if btnp(KEY_SPACE) or btnp(KEY_DOWN) or btnp(KEY_UP) or btnp(KEY_LEFT) or btnp(KEY_RIGHT) or btnp(KEY_RETURN) then if btnp(keyShoot) or btnp(keyDown) or btnp(keyUp) or btnp(keyLeft) or btnp(keyRight) or btnp(KEY_RETURN) or
padp(btnShoot) or padp(btnDown) or padp(btnUp) or padp(btnLeft) or padp(btnRight) then
if scenes.dnum==#scenes.current_scene then if scenes.dnum==#scenes.current_scene then
stopmusic() stopmusic()
if batman.endgame then if batman.endgame then
final_init() final_init()
fade.fadeoutin() fade.fadeoutin()
else else
_update=old_update game_update=old_update
end end
else else
scenes.dnum=scenes.dnum+1 scenes.dnum=scenes.dnum+1
scenes.step=2 scenes.step=2
end end
end end
elseif btnp(KEY_SPACE) then elseif btnp(keyShoot) or padp(btnShoot) then
scenes.step=8 scenes.step=8
end end
end end