25 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
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
b95650cee0 - Reestructuració 2023-01-13 19:16:34 +01:00
22be7de746 - [FIX] Pause reactivated 2023-01-13 16:55:53 +01:00
ecb36d8483 - [FIX] Prevent exiting the final scene with ESC 2023-01-13 14:55:37 +01:00
b7e3a3c78b - Trace removed 2023-01-13 14:34:42 +01:00
e7e3c235fe - [FIX] Sometimes stuck on "life lost" scene
- [FIX] No shot sound if walking
2023-01-13 14:33:32 +01:00
3300a4d93b - [FIX]Al acabar el joc, tornava amb el mapa tal qual, sense resetejar. 2023-01-13 14:27:41 +01:00
6f0b00442d - Ortografia
- Indicador de "pulsa tecla per a seguir"
- Es pot seguir pulsant qualsevol tecla
2023-01-13 14:24:21 +01:00
3d9cbaef3d - segon teleport
- tecles debug llevades
2023-01-13 14:23:28 +01:00
a5f8703830 - Game over and life lost music plays only once. 2023-01-13 13:21:54 +01:00
8019332de1 - Implementat el teleport desde l'habitació secreta ;) 2023-01-12 20:03:41 +01:00
58 changed files with 546 additions and 188 deletions

6
.gitignore vendored Normal file
View File

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

44
bin/Info.plist Normal file
View File

@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BuildMachineOSBuild</key>
<string>19H2</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>cacaus</string>
<key>CFBundleExecutable</key>
<string>cacaus</string>
<key>CFBundleIconFile</key>
<string>cacaus</string>
<key>CFBundleIconName</key>
<string>cacaus</string>
<key>CFBundleIdentifier</key>
<string>net.jailers.cacaus</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>cacaus</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.1.0</string>
<key>CSResourcesFileMapped</key>
<true/>
<key>LSMinimumSystemVersion</key>
<string>10.12</string>
<key>NSHighResolutionCapable</key>
<true/>
<key>NSHumanReadableCopyright</key>
<string>Copyright 2023 JailDoctor</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>SUPublicDSAKeyFile</key>
<string>dsa_pub.pem</string>
</dict>
</plist>

BIN
bin/cacaus.icns Normal file

Binary file not shown.

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}}
function abad_nop()
@@ -43,14 +45,17 @@ function abad_hurt(howmuch)
if abad.vides==0 then
--final de la partida
dead.start()
playmus(audio_game_over)
playmus(audio_game_over,0)
else
playmus(audio_life_lost)
playmus(audio_life_lost,0)
abad.energia=40
abad.hab=abad.safe.hab
abad.x=abad.safe.x
abad.y=abad.safe.y
abad.hurting=60
abad.update=abad_state_normal
abad.bb.y=0
abad.bb.h=16
abad.respawning=240
cls(3)
end
@@ -78,13 +83,13 @@ function abad_state_normal()
end
abad_make_safe()
if btn(KEY_RIGHT) then
if btn(keyRight) or pad(btnRight) then
abad.update=abad_state_walking
abad.flip=false
elseif btn(KEY_LEFT) then
elseif btn(keyLeft) or pad(btnLeft) then
abad.update=abad_state_walking
abad.flip=true
elseif btn(KEY_UP) then
elseif btn(keyJump) or pad(btnJump) then
abad.update=abad_state_jumping
abad.step=0
abad.jumpfwd=false
@@ -93,11 +98,11 @@ function abad_state_normal()
abad.jump=nil
end
playsnd(audio_abad_jump)
elseif btn(KEY_DOWN) then
elseif btn(keyDown) or pad(btnDown) then
abad.update=abad_state_crouch
elseif btn(KEY_Z) then
abad.respawning=240
elseif btnp(KEY_SPACE) and cacau.hab==-1 then
--elseif btn(KEY_Z) then
-- abad.respawning=240
elseif btn(keyShoot) or pad(btnShoot) and cacau.hab==-1 then
playsnd(audio_abad_shot)
abad.update=abad_state_fire
abad.wait=0
@@ -113,7 +118,7 @@ function abad_state_crouch()
abad.step=0
abad.jumpfwd=false
if not btn(KEY_DOWN) then
if not (btn(keyDown) or pad(btnDown)) then
abad.update=abad_state_normal
abad.bb.y=0
abad.bb.h=16
@@ -182,7 +187,7 @@ function abad_state_walking()
abad_make_safe()
if btn(KEY_UP) then
if btn(keyJump) or pad(btnJump) then
abad.update=abad_state_jumping
abad.step=0
abad.jumpfwd=true
@@ -192,17 +197,18 @@ function abad_state_walking()
end
playsnd(audio_abad_jump)
return
elseif btn(KEY_DOWN) then
elseif btn(keyDown) or pad(btnDown) then
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)
abad.update=abad_state_fire
abad.wait=0
cacau.init(abad.hab,abad.x+8,abad.y+8,abad.flip)
end
if btn(KEY_RIGHT) then
if btn(keyRight) or pad(btnRight) then
abad.flip=false
elseif btn(KEY_LEFT) then
elseif btn(keyLeft) or pad(btnLeft) then
abad.flip=true
elseif abad.wait==0 then
abad.update=abad_state_normal
@@ -293,15 +299,15 @@ function abad_state_stairs()
if abad.wait==6 then
abad.wait=0
if btn(KEY_RIGHT) then
if btn(keyRight) or pad(btnRight) then
abad.flip=false
abad_advance()
playsnd(audio_low)
elseif btn(KEY_LEFT) then
elseif btn(keyLeft) or pad(btnLeft) then
abad.flip=true
abad_advance()
playsnd(audio_low)
elseif btn(KEY_UP) then
elseif btn(keyUp) or pad(btnUp) 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
abad.y=abad.y-2
@@ -312,7 +318,7 @@ function abad_state_stairs()
imp.reset()
abad.y=32
end
elseif btn(KEY_DOWN) then
elseif btn(keyDown) or pad(btnDown) 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
abad.y=abad.y+2

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()
@@ -213,12 +215,6 @@ function batman.update_stairs()
if batman.wait>=6 then
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.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

View File

@@ -8,7 +8,7 @@ function dead.start()
dead.pos[i]=0
dead.vel[i]=(200+rnd(400))/400
end
_update=dead.update
game_update=dead.update
end
function dead.update()
@@ -39,10 +39,8 @@ function dead.update()
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_init(true)
--_init()
--_update=update_game
end
end

View File

@@ -223,12 +223,6 @@ function elalien.update_stairs()
if elalien.wait>=6 then
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.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

View File

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

View File

@@ -6,7 +6,7 @@ function final_init()
current_actor=1
abad.update = abad_nop
_update=update_final
game_update=update_final
next_actor()
playmus(audio_final)
local r,g,b=getcolor(15)
@@ -128,7 +128,7 @@ function next_actor()
init_actor("EL ABAD",true,16,16,{0,1,0,2})
elseif current_actor==14 then
final_count=0
_update=update_final2
game_update=update_final2
fade.fadeoutin()
end
final_room=final_rooms[current_actor]
@@ -150,7 +150,8 @@ function update_final2()
end
end
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_init(true)
fade.fadeoutin()
end

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
@@ -20,16 +38,16 @@ function remove_actor(actor)
end
end
function playmus(song,volume)
function playmus(song,loop)
if not mute then
playmusic(song,volume)
playmusic(song,loop)
end
end
function playsnd(sound,volume)
if not mute then
--print(sound)
playsound(sound,volume)
return playsound(sound,volume)
end
end
@@ -115,8 +133,13 @@ function game_init(menu)
table.insert(actors,trigger.new(56,32,32,triggers.escena_abad_porta_batman))
table.insert(actors,trigger.new(19,32,32,triggers.escena_habitacio_batman))
score.create()
table.insert(actors,trigger.new(14,40,32,triggers.teleport_a))
table.insert(actors,trigger.new(67,8,32,triggers.teleport_b))
table.insert(actors,trigger.new(29,40,32,triggers.teleport_c))
table.insert(actors,trigger.new(61,8,32,triggers.teleport_d))
score.create()
cameras[0]=gps
table.insert(cameras,gorro)
table.insert(cameras,peu)
@@ -127,33 +150,21 @@ function game_init(menu)
mapa_do_backup()
if menu then
menu_sel=0
menu_state=0
abad.update = abad_nop
_update=update_menu
game_update=update_menu
menu_count=0
menu_change_room=300
menu_room=rnd(60)
playmus(audio_main_song)
else
_update=update_game
game_update=update_game
stopmusic()
end
--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)
@@ -180,10 +191,10 @@ function update_dialog()
text("(Y)es (N)o",25,40,2)
if btnp(KEY_N) then
_update=update_game
game_update=update_game
elseif btnp(KEY_Y) then
mapa_save()
_update=update_game
game_update=update_game
end
end
@@ -215,7 +226,7 @@ function update_game()
elseif btnp(KEY_RETURN) then
mode=modes.playing
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
mapa_cycle_colors(abad.hab)
elseif btnp(KEY_M) then
@@ -286,22 +297,25 @@ function update_game()
fireball.update()
switches.update()
local hx = abad.hab%10
local hy = flr(abad.hab/10)
if btnp(KEY_RETURN) then
mode=modes.editing
mapa_restore_backup()
elseif btn(KEY_LSHIFT) and btnp(KEY_RIGHT) and hx<9 then
abad.hab=abad.hab+1
elseif btn(KEY_LSHIFT) and btnp(KEY_LEFT) and hx>0 then
abad.hab=abad.hab-1
elseif btn(KEY_LSHIFT) and btnp(KEY_DOWN) and hy<7 then
abad.hab=abad.hab+10
elseif btn(KEY_LSHIFT) and btnp(KEY_UP) and hy>0 then
abad.hab=abad.hab-10
elseif btnp(KEY_M) then
mute = not mute
elseif btnp(KEY_ESCAPE) then
--local hx = abad.hab%10
--local hy = flr(abad.hab/10)
--if btnp(KEY_RETURN) then
-- mode=modes.editing
-- mapa_restore_backup()
--elseif btn(KEY_LSHIFT) and btnp(KEY_RIGHT) and hx<9 then
-- abad.hab=abad.hab+1
--elseif btn(KEY_LSHIFT) and btnp(KEY_LEFT) and hx>0 then
-- abad.hab=abad.hab-1
--elseif btn(KEY_LSHIFT) and btnp(KEY_DOWN) and hy<7 then
-- abad.hab=abad.hab+10
--elseif btn(KEY_LSHIFT) and btnp(KEY_UP) and hy>0 then
-- abad.hab=abad.hab-10
--elseif btnp(KEY_M) then
-- mute = not mute
--elseif btnp(KEY_ESCAPE) then
-- pause()
--end
if btnp(KEY_ESCAPE) or padp(btnPause) then
pause()
end
if abad.objects.gps~=nil then
@@ -316,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)
@@ -351,19 +360,171 @@ function update_menu()
cacau.update()
fireball.update()
switches.update()
end
if btnp(KEY_SPACE) then
game_exit()
game_init()
fade.fadeoutin()
elseif btnp(KEY_M) then
mute = not mute
if mute then
stopmusic()
else
playmus(audio_main_song)
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()
@@ -382,24 +543,39 @@ function pause()
sspr(0,0,128,96,0,0)
setdest(0)
setsource(tiles)
pause_old_update=_update
_update=update_pause
pausa_option=1
pause_old_update=game_update
game_update=update_pause
end
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)
_update = pause_old_update
elseif btnp(KEY_SPACE) then
game_exit()
game_init(true)
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
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,8 +1,13 @@
require "fade"
require "game"
require "mapa"
require "scenes"
intro_wait=40
intro_step=0
function intro_init()
_update = intro_intro
game_update = intro_intro
intro_wait=400
cls(16)
setdest(logo)
@@ -19,9 +24,9 @@ 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(KEY_SPACE) then
if intro_wait==0 or btnp(KEY_ESCAPE) or btnp(keyShoot) or padp(btnShoot) or padp(btnPause) then
intro_wait=1
_update = intro_update
game_update = intro_update
fade.fadeoutin()
end
if btnp(KEY_M) then
@@ -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

108
data/main.lua Normal file
View File

@@ -0,0 +1,108 @@
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()
tiles=loadsurf("tiles.gif")
setsource(tiles)
local pal=loadpal("tiles.gif")
setpal(pal)
logo=newsurf(36,5)
back=newsurf(128,96)
fade.init()
audio_text_abad = loadsound(audio_text_abad)
audio_text_premiere = loadsound(audio_text_premiere)
audio_text_elalien = loadsound(audio_text_elalien)
audio_text_batman = loadsound(audio_text_batman)
audio_abad_jump = loadsound(audio_abad_jump)
audio_abad_fall = loadsound(audio_abad_fall)
audio_abad_hit = loadsound(audio_abad_hit)
audio_abad_shot = loadsound(audio_abad_shot)
audio_abad_step[1] = loadsound(audio_abad_step[1])
audio_abad_step[2] = loadsound(audio_abad_step[2])
audio_abad_step[3] = loadsound(audio_abad_step[3])
audio_abad_step[4] = audio_abad_step[2]
audio_switch = loadsound(audio_switch)
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()
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}
mapa.wait=0
mapa.step=0
@@ -162,7 +163,7 @@ function mapa_create_minimap()
end
end
end
_update=mapa_draw_minimap
game_update=mapa_draw_minimap
end
function mapa_draw_minimap()

View File

@@ -1,15 +1,18 @@
require "final"
require "audio"
scenes={
intro_01= {
{x=3,y=0,flip=false,audio="abad",text={"Ah!, que 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},
},
intro_02= {
{x=3,y=0,flip=false,audio="abad",text={"Eh! On està el","bol de cacaus???",""},die=20},
},
intro_03= {
{x=4,y=48,flip=true,audio="batman",musica=audio_song_batman,text={"ME'L HE ENDUT JO!!!", "S'HAN ACABAT ELS","CACAUS PA TU!"},die=20},
{x=3,y=0,flip=false,audio="abad",text={"Qué??","Però perqué???",""},die=20},
{x=4,y=48,flip=true,audio="batman",text={"Estás com una vaca!","Has de deixar de menjar", "eixes gorrinades"},die=20},
{x=4,y=48,flip=true,audio="batman",text={"Mira'm a mí. Estic","tot buenorro i faig", "esport"},die=20},
{x=4,y=48,flip=true,audio="batman",musica=audio_song_batman,text={"ME L'HE ENDUT JO!!!", "S'HAN ACABAT ELS","CACAUS PA TU!"},die=20},
{x=3,y=0,flip=false,audio="abad",text={"Què??","Però perquè???",""},die=20},
{x=4,y=48,flip=true,audio="batman",text={"Estàs com una vaca!","Has de deixar de menjar", "eixes gorrinades"},die=20},
{x=4,y=48,flip=true,audio="batman",text={"Mira'm a mi. Estic","tot buenorro i faig", "esport"},die=20},
{x=3,y=0,flip=false,audio="abad",text={"Esport?????","I una merda!!","He de cuidar la panxa!"},die=20},
{x=4,y=48,flip=true,audio="batman",text={"Pos t'aguantes.","Ja pots despedir-te", "dels cacaus..."},die=20},
},
@@ -40,7 +43,7 @@ scenes={
},
gps_trobat={
{x=4,y=0,flip=false,audio="abad",text={"Ale, ja tinc el GPS.","Ara puc trobar tot","el que necessite..."}},
{x=4,y=0,flip=false,audio="abad",text={"polsant les tecles","del 1 al 5",""}},
{x=4,y=0,flip=false,audio="abad",text={"polsant les tecles","de l'1 al 5",""}},
},
premiere_intro={
{x=4,y=0,flip=false,audio="abad",musica=audio_song_premiere,text={"Premiere??","Qué fas per ma casa?",""}},
@@ -141,11 +144,11 @@ function start_scene(scene,offset)
scenes.die=scenes.current_scene[scenes.dnum].die or 0
if scene[1].musica then
--print(scene[1].musica)
playmus(scenes.current_scene[scenes.dnum].musica, 64)
playmus(scenes.current_scene[scenes.dnum].musica)
end
if offset then scenes.offset=offset end
old_update=_update
_update=update_scene
old_update=game_update
game_update=update_scene
end
function playtext(snd)
@@ -243,50 +246,62 @@ function update_scene()
if scenes.wait==6 then
scenes.wait=0
draw_scene()
if scenes.step>8 and scenes.die>0 then
scenes.die=scenes.die-1
if scenes.die==0 then
if scenes.dnum==#scenes.current_scene then
stopmusic()
if batman.endgame then
final_init()
fade.fadeoutin()
if scenes.step>8 then
--print(scenes.die)
if scenes.die>0 then
scenes.die=scenes.die-1
if scenes.die==0 then
if scenes.dnum==#scenes.current_scene then
stopmusic()
if batman.endgame then
final_init()
fade.fadeoutin()
else
game_update=old_update
end
else
_update=old_update
scenes.dnum=scenes.dnum+1
scenes.die=scenes.current_scene[scenes.dnum].die or 0
scenes.step=2
end
end
else
if flr(time()*2)%2==0 then
sspr(104,88,7,5,118,56)
else
scenes.dnum=scenes.dnum+1
scenes.die=scenes.current_scene[scenes.dnum].die or 0
scenes.step=2
rectfill(118,56,125,61,12)
end
end
end
end
if btnp(KEY_ESCAPE) 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
pause()
end
elseif btnp(KEY_SPACE) then
if scenes.step>8 then
elseif btnp(KEY_M) then
mute = not mute
end
if scenes.step>8 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
stopmusic()
if batman.endgame then
final_init()
fade.fadeoutin()
else
_update=old_update
game_update=old_update
end
else
scenes.dnum=scenes.dnum+1
scenes.step=2
end
else
scenes.step=8
end
elseif btnp(KEY_M) then
mute = not mute
elseif btnp(keyShoot) or padp(btnShoot) then
scenes.step=8
end
end

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 4.7 KiB

View File

@@ -68,3 +68,41 @@ function triggers:escena_habitacio_batman()
end
end
end
function triggers:teleport_a()
abad.teleport=true
playsnd(audio_hit)
cls(14)
imp.reset()
abad.hab=67
abad.x=24
end
function triggers:teleport_b()
if abad.teleport then
playsnd(audio_hit)
cls(14)
imp.reset()
abad.hab=14
abad.x=16
end
end
function triggers:teleport_c()
abad.teleport2=true
playsnd(audio_hit)
cls(14)
imp.reset()
abad.hab=61
abad.x=24
end
function triggers:teleport_d()
if abad.teleport2 then
playsnd(audio_hit)
cls(14)
imp.reset()
abad.hab=29
abad.x=24
end
end

View File

@@ -1,32 +0,0 @@
function _init()
tiles=loadsurf("tiles.gif")
setsource(tiles)
local pal=loadpal("tiles.gif")
setpal(pal)
logo=newsurf(36,5)
back=newsurf(128,96)
fade.init()
audio_text_abad = loadsound(audio_text_abad)
audio_text_premiere = loadsound(audio_text_premiere)
audio_text_elalien = loadsound(audio_text_elalien)
audio_text_batman = loadsound(audio_text_batman)
audio_abad_jump = loadsound(audio_abad_jump)
audio_abad_fall = loadsound(audio_abad_fall)
audio_abad_hit = loadsound(audio_abad_hit)
audio_abad_shot = loadsound(audio_abad_shot)
audio_abad_step[1] = loadsound(audio_abad_step[1])
audio_abad_step[2] = loadsound(audio_abad_step[2])
audio_abad_step[3] = loadsound(audio_abad_step[3])
audio_abad_step[4] = audio_abad_step[2]
audio_switch = loadsound(audio_switch)
audio_hit = loadsound(audio_hit)
audio_low = loadsound(audio_low)
--game_init()
intro_init()
--final_init()
end
function _update() end