36 Commits

Author SHA1 Message Date
5e9d4cb50f Update readme.md 2026-03-25 10:03:50 +01:00
cdc536579d - [FIX] Canvis per a usar correctament textos utf8 i el nou sistema de fonts 2026-03-18 10:34:08 +01:00
df277fb0e4 - [NEW] Els botons de cicle avant i arrere de la vista de GPS en el pad, i la pausa en el pad ara es poden redefinir. 2025-10-30 16:46:12 +01:00
639fd6e34d - Passat a mini v1.3.7
- [NEW] ara es pot activar i desactivar el só, des del nou menu d'opcions i desde el menu in-game
- [NEW] menus canviats un poc
2025-10-30 16:31:07 +01:00
a5d097aa50 - Passat a mini v1.3.6 2025-10-30 12:39:44 +01:00
5fef769534 Update readme.md 2025-02-17 18:34:07 +01:00
4e7d770170 Update readme.md 2025-02-17 18:32:51 +01:00
beb9a47f01 Update readme.md 2025-01-05 14:40:04 +01:00
c815c009cf Add readme.md 2025-01-05 13:07:59 +01:00
9afc51f9a0 - Ja funciona en la ultima versió de mini (v0.9.95d) 2024-11-24 20:21:14 +01:00
75a1fb95d9 - [NEW] F1 reduix el zoom de la finestra fins a 1x.
- [NEW] F2 augmenta el zoom de la finestra fins al màxim que cap a la pantalla.
2023-10-09 11:44:23 +02:00
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
63 changed files with 1273 additions and 845 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()
@@ -16,8 +18,8 @@ function abad:draw()
if abad.update==abad_state_stairs then
flip=(((abad.x>>1)+(abad.y>>1))%2)==0
end
if (abad.respawning==0) or (flr(abad.respawning/15)%2==0) then
sspr(abad.frame*16,0,16,16,abad.x,abad.y,16,16,flip)
if (abad.respawning==0) or (math.floor(abad.respawning/15)%2==0) then
draw.surf(abad.frame*16,0,16,16,abad.x,abad.y,16,16,flip)
end
if abad.respawning > 0 then
@@ -36,26 +38,29 @@ end
function abad_hurt(howmuch)
if abad.hurting == 0 and abad.respawning==0 then
playsnd(audio_abad_hit)
sound.play(audio_abad_hit)
abad.energia=abad.energia-howmuch
if abad.energia<=0 then
abad.vides=abad.vides-1
if abad.vides==0 then
--final de la partida
dead.start()
playmus(audio_game_over)
music.play(audio_game_over,0)
else
playmus(audio_life_lost)
music.play(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)
surf.cls(3)
end
else
cls(3)
surf.cls(3)
end
end
end
@@ -78,27 +83,27 @@ function abad_state_normal()
end
abad_make_safe()
if btn(KEY_RIGHT) then
if key.down(keyRight) or pad.down(btnRight) then
abad.update=abad_state_walking
abad.flip=false
elseif btn(KEY_LEFT) then
elseif key.down(keyLeft) or pad.down(btnLeft) then
abad.update=abad_state_walking
abad.flip=true
elseif btn(KEY_UP) then
elseif key.down(keyJump) or pad.down(btnJump) then
abad.update=abad_state_jumping
abad.step=0
abad.jumpfwd=false
if abad.jump then
stopsound(abad.jump)
sound.stop(abad.jump)
abad.jump=nil
end
playsnd(audio_abad_jump)
elseif btn(KEY_DOWN) then
sound.play(audio_abad_jump)
elseif key.down(keyDown) or pad.down(btnDown) then
abad.update=abad_state_crouch
elseif btn(KEY_Z) then
abad.respawning=240
elseif btnp(KEY_SPACE) and cacau.hab==-1 then
playsnd(audio_abad_shot)
--elseif btn(KEY_Z) then
-- abad.respawning=240
elseif key.down(keyShoot) or pad.down(btnShoot) and cacau.hab==-1 then
sound.play(audio_abad_shot)
abad.update=abad_state_fire
abad.wait=0
cacau.init(abad.hab,abad.x+8,abad.y+8,abad.flip)
@@ -113,7 +118,7 @@ function abad_state_crouch()
abad.step=0
abad.jumpfwd=false
if not btn(KEY_DOWN) then
if not (key.down(keyDown) or pad.down(btnDown)) then
abad.update=abad_state_normal
abad.bb.y=0
abad.bb.h=16
@@ -166,7 +171,7 @@ function abad_state_walking()
abad.wait=0
abad.step=(abad.step+1)%2
if abad.step==0 then
playsnd(audio_abad_step[abad.mustep],32)
sound.play(audio_abad_step[abad.mustep],32)
abad.mustep = abad.mustep + 1
if abad.mustep == 5 then abad.mustep=1 end
end
@@ -182,27 +187,28 @@ function abad_state_walking()
abad_make_safe()
if btn(KEY_UP) then
if key.down(keyJump) or pad.down(btnJump) then
abad.update=abad_state_jumping
abad.step=0
abad.jumpfwd=true
if abad.jump then
stopsound(abad.jump)
sound.stop(abad.jump)
abad.jump=nil
end
playsnd(audio_abad_jump)
sound.play(audio_abad_jump)
return
elseif btn(KEY_DOWN) then
elseif key.down(keyDown) or pad.down(btnDown) then
abad.update=abad_state_crouch
elseif btn(KEY_SPACE) and cacau.hab==-1 then
elseif key.down(keyShoot) or pad.down(btnShoot) and cacau.hab==-1 then
sound.play(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 key.down(keyRight) or pad.down(btnRight) then
abad.flip=false
elseif btn(KEY_LEFT) then
elseif key.down(keyLeft) or pad.down(btnLeft) then
abad.flip=true
elseif abad.wait==0 then
abad.update=abad_state_normal
@@ -220,8 +226,8 @@ function abad_state_jumping()
if abad.jumpfwd then abad_advance() end
--local xx=flr((abad.x+4)/8)
--local yy=flr(abad.y/8)
--local xx=math.floor((abad.x+4)/8)
--local yy=math.floor(abad.y/8)
--rect(xx*8,yy*8, (xx+2)*8,(yy+1)*8)
if abad.step<6 then
if abad.y>0 then
@@ -230,14 +236,14 @@ function abad_state_jumping()
if check_tile(abad.hab,abad.x+4,abad.y-2)==tiletype.switch then
-- Executar el switch
local xx=min(11,max(0,flr((abad.x+4)/8)))
local yy=min(5,max(0,flr((abad.y-2)/8)))
local xx=math.min(11,math.max(0,math.floor((abad.x+4)/8)))
local yy=math.min(5,math.max(0,math.floor((abad.y-2)/8)))
switches.start(abad.hab,1+xx+yy*12)
--cls(4)
elseif (abad.x+4)&7~=0 and check_tile(abad.hab,abad.x+12,abad.y-2)==tiletype.switch then
-- Executar el switch
local xx=min(11,max(0,flr((abad.x+12)/8)))
local yy=min(5,max(0,flr((abad.y-2)/8)))
local xx=math.min(11,math.max(0,math.floor((abad.x+12)/8)))
local yy=math.min(5,math.max(0,math.floor((abad.y-2)/8)))
switches.start(abad.hab,1+xx+yy*12)
--cls(4)
else
@@ -252,7 +258,7 @@ function abad_state_jumping()
end
elseif abad.step>6 then
abad.update=abad_state_falling
abad.jump=playsnd(audio_abad_fall)
abad.jump=sound.play(audio_abad_fall)
end
abad.step=abad.step+1
end
@@ -268,8 +274,8 @@ function abad_state_falling()
if abad.jumpfwd then abad_advance() end
local xx=flr((abad.x+4)/8)
local yy=flr((abad.y+16)/8)
local xx=math.floor((abad.x+4)/8)
local yy=math.floor((abad.y+16)/8)
if abad.y<32 then
if (abad.y+16)&7==0 and (check_tile(abad.hab,abad.x+4,abad.y+16)>=tiletype.half or ((abad.x+4)&7~=0 and check_tile(abad.hab,abad.x+12,abad.y+16)>=tiletype.half)) then
@@ -293,30 +299,30 @@ function abad_state_stairs()
if abad.wait==6 then
abad.wait=0
if btn(KEY_RIGHT) then
if key.down(keyRight) or pad.down(btnRight) then
abad.flip=false
abad_advance()
playsnd(audio_low)
elseif btn(KEY_LEFT) then
sound.play(audio_low)
elseif key.down(keyLeft) or pad.down(btnLeft) then
abad.flip=true
abad_advance()
playsnd(audio_low)
elseif btn(KEY_UP) then
sound.play(audio_low)
elseif key.down(keyUp) or pad.down(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
playsnd(audio_low)
sound.play(audio_low)
end
else
abad.hab=abad.hab-10
imp.reset()
abad.y=32
end
elseif btn(KEY_DOWN) then
elseif key.down(keyDown) or pad.down(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
playsnd(audio_low)
sound.play(audio_low)
end
else
abad.hab=abad.hab+10

View File

@@ -44,7 +44,7 @@ end
function bambolla.draw_normal()
if bambolla.enabled then
sspr(112,16,16,16,bambolla.x,bambolla.y,16,16)
draw.surf(112,16,16,16,bambolla.x,bambolla.y,16,16)
end
end
@@ -58,7 +58,7 @@ function bambolla.update_normal()
bambolla.wait=0
if not bambolla.enabled then
bambolla.counter=bambolla.counter-1
local r = rnd(bambolla.counter)
local r = math.random(0,bambolla.counter-1)
--print(r)
if bambolla.counter==1 or r==1 then
bambolla.init()
@@ -77,9 +77,9 @@ function bambolla.update_normal()
bambolla.reset()
end
end
bambolla.y=28-abs(sin(bambolla.x*0.1))*24
bambolla.y=28-math.abs(math.sin(bambolla.x*0.1))*24
if bambolla.hab==abad.hab and bambolla.y>25.2 then
playsnd(audio_low)
sound.play(audio_low)
end
if bambolla.hab==abad.hab then
if cacau.hab==bambolla.hab and aabb(bambolla,cacau) then
@@ -89,7 +89,7 @@ function bambolla.update_normal()
bambolla.y=bambolla.y+8
bambolla.dx=0
bambolla.dy=-4
playsnd(audio_hit)
sound.play(audio_hit)
end
if aabb(bambolla,abad) then
abad_hurt(1)
@@ -109,14 +109,14 @@ bambolla.update=bambolla.update_normal
bambolla.draw=bambolla.draw_normal
function bambolla.draw_splash()
circfill(bambolla.cx+bambolla.dx,bambolla.y,2,16)
circfill(bambolla.cx+bambolla.dx,bambolla.y,1,6)
circfill(bambolla.cx-bambolla.dx,bambolla.y,2,16)
circfill(bambolla.cx-bambolla.dx,bambolla.y,1,6)
circfill(bambolla.cx-(bambolla.dx/2),bambolla.y-4,2,16)
circfill(bambolla.cx-(bambolla.dx/2),bambolla.y-4,1,6)
circfill(bambolla.cx+(bambolla.dx/2),bambolla.y-4,2,16)
circfill(bambolla.cx+(bambolla.dx/2),bambolla.y-4,1,6)
draw.circf(bambolla.cx+bambolla.dx,bambolla.y,2,16)
draw.circf(bambolla.cx+bambolla.dx,bambolla.y,1,6)
draw.circf(bambolla.cx-bambolla.dx,bambolla.y,2,16)
draw.circf(bambolla.cx-bambolla.dx,bambolla.y,1,6)
draw.circf(bambolla.cx-(bambolla.dx/2),bambolla.y-4,2,16)
draw.circf(bambolla.cx-(bambolla.dx/2),bambolla.y-4,1,6)
draw.circf(bambolla.cx+(bambolla.dx/2),bambolla.y-4,2,16)
draw.circf(bambolla.cx+(bambolla.dx/2),bambolla.y-4,1,6)
end
function bambolla.update_splash()

View File

@@ -5,7 +5,9 @@ function batman.init()
batman.update=batman.update_normal
batman.draw=batman.draw
local habs={5,9,46,36,18}
batman.hab=habs[1+rnd(#habs)]
batman.hab=habs[1+math.random(0,#habs-1)]
batman.x=24
batman.y=24
end
function batman.draw()
@@ -13,7 +15,7 @@ function batman.draw()
if batman.update==batman.update_stairs then
flip=(((batman.x>>1)+(batman.y>>1))%2)==0
end
sspr((batman.frame&7)*16,(batman.frame>>3)*16,16,16,batman.x,batman.y,16,16,flip)
draw.surf((batman.frame&7)*16,(batman.frame>>3)*16,16,16,batman.x,batman.y,16,16,flip)
end
function batman.hit()
@@ -56,7 +58,7 @@ function batman.update_normal()
batman.x=84
end
elseif check_tile(batman.hab,batman.x+inc,batman.y+6)<tiletype.half then
local r=rnd(2)
local r=math.random(0,1)
if check_tile(batman.hab,batman.x+inc,batman.y+14)==tiletype.block then r=0 end
if batman.stepscooldown>0 and check_tile(batman.hab,batman.x+inc,batman.y+14)==tiletype.half then r=batman.stepsremember end
if r==0 then
@@ -88,7 +90,7 @@ function batman.update_normal()
if batman.stairscooldown==0 and
check_tile(batman.hab,batman.x+6,batman.y+8)==tiletype.stair and
check_tile(batman.hab,batman.x+14,batman.y+8)==tiletype.stair then
if rnd(10)<8 then
if math.random(0,9)<8 then
batman.update=batman.update_stairs
if check_tile(batman.hab,batman.x+4,batman.y+16)==tiletype.block then
batman.goup=true
@@ -106,7 +108,7 @@ function batman.update_normal()
end
if check_tile(batman.hab,batman.x+4,batman.y+16)==tiletype.void and ((batman.x+4)&7==0 or check_tile(batman.hab,batman.x+12,batman.y+16)==tiletype.void) then
local option=rnd(2)
local option=math.random(0,1)
if batman.stairscooldown>0 then option=0 end
if option==0 then
batman.update=batman.update_falling
@@ -213,19 +215,13 @@ 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
batman.y=batman.y-2
else
batman.update=batman.update_normal
if rnd(3)>0 then batman.flip=not batman.flip end
if math.random(0,2)>0 then batman.flip=not batman.flip end
batman.stairscooldown=50
end
else
@@ -238,7 +234,7 @@ function batman.update_stairs()
batman.y=batman.y+2
else
batman.update=batman.update_normal
if rnd(3)>0 then batman.flip=not batman.flip end
if math.random(0,2)>0 then batman.flip=not batman.flip end
batman.stairscooldown=50
end
else

View File

@@ -6,7 +6,7 @@ function bol.init()
end
function bol.draw()
sspr(112,88,16,8,bol.x,bol.y,16,8)
draw.surf(112,88,16,8,bol.x,bol.y,16,8)
end
function bol.update()

View File

@@ -8,12 +8,12 @@ function cacau.init(_hab,_x,_y,_flip)
cacau.flip=_flip
end
function cacau:draw()
circfill(cacau.x,cacau.y,2,16)
circfill(cacau.x,cacau.y,1,6)
function cacau.draw()
draw.circf(cacau.x,cacau.y,2,16)
draw.circf(cacau.x,cacau.y,1,6)
end
function cacau:update()
function cacau.update()
if cacau.hab == -1 then return end
cacau.wait=cacau.wait+1

View File

@@ -5,7 +5,7 @@ function caco.new(_hab,_x,_y,_flip)
end
function caco:draw()
if self.frame>0 then sspr((self.frame&7)*16,(self.frame>>3)*16,16,16,self.x,self.y,16,16,self.flip) end
if self.frame>0 then draw.surf((self.frame&7)*16,(self.frame>>3)*16,16,16,self.x,self.y,16,16,self.flip) end
end
function caco:update_normal()

View File

@@ -6,9 +6,9 @@ function dead.start()
dead.vel={}
for i=1,128 do
dead.pos[i]=0
dead.vel[i]=(200+rnd(400))/400
dead.vel[i]=(200+math.random(0,399))/400
end
_update=dead.update
game_update=dead.update
end
function dead.update()
@@ -16,33 +16,31 @@ function dead.update()
for i=1,128 do
if dead.pos[i]<96 then
dead.pos[i]=dead.pos[i]+dead.vel[i]
vline(i-1,0,dead.pos[i],16)
draw.vline(i-1,0,dead.pos[i],16)
end
end
if dead.count>50 then
if dead.count>130 then
prnt("GAME OVER",44,40,2)
draw.text("GAME OVER",44,40,2)
elseif dead.count>120 then
prnt("GAME OVE",44,40,2)
draw.text("GAME OVE",44,40,2)
elseif dead.count>110 then
prnt("GAME OV",44,40,2)
draw.text("GAME OV",44,40,2)
elseif dead.count>100 then
prnt("GAME O",44,40,2)
draw.text("GAME O",44,40,2)
elseif dead.count>90 then
prnt("GAME",44,40,2)
draw.text("GAME",44,40,2)
elseif dead.count>80 then
prnt("GAM",44,40,2)
draw.text("GAM",44,40,2)
elseif dead.count>70 then
prnt("GA",44,40,2)
draw.text("GA",44,40,2)
elseif dead.count>60 then
prnt("G",44,40,2)
draw.text("G",44,40,2)
end
end
if (dead.count>250 and btnp(KEY_SPACE)) or dead.count>500 then
if (dead.count>250 and (key.press(keyShoot) or pad.press(btnShoot))) or dead.count>500 then
game_exit()
game_init(true)
--_init()
--_update=update_game
end
end

View File

@@ -11,7 +11,7 @@ function elalien.init()
elalien.scene_intro=false
elalien.scene_object=false
local habs={66,56,59,53}
elalien.hab=habs[1+rnd(4)]
elalien.hab=habs[1+math.random(0,3)]
end
function elalien.draw()
@@ -19,7 +19,7 @@ function elalien.draw()
if elalien.update==elalien.update_stairs then
flip=(((elalien.x>>1)+(elalien.y>>1))%2)==0
end
sspr((elalien.frame&7)*16,(elalien.frame>>3)*16,16,16,elalien.x,elalien.y,16,16,flip)
draw.surf((elalien.frame&7)*16,(elalien.frame>>3)*16,16,16,elalien.x,elalien.y,16,16,flip)
end
function elalien.hit()
@@ -56,7 +56,7 @@ function elalien.update_normal()
elalien.x=84
end
elseif check_tile(elalien.hab,elalien.x+inc,elalien.y+6)<tiletype.half then
local r=rnd(2)
local r=math.random(0,1)
if check_tile(elalien.hab,elalien.x+inc,elalien.y+14)==tiletype.block then r=0 end
if r==0 then
elalien.update=elalien.update_jumping
@@ -83,7 +83,7 @@ function elalien.update_normal()
if elalien.stairscooldown==0 and
check_tile(elalien.hab,elalien.x+6,elalien.y+8)==tiletype.stair and
check_tile(elalien.hab,elalien.x+14,elalien.y+8)==tiletype.stair then
if rnd(10)<8 then
if math.random(0,9)<8 then
elalien.update=elalien.update_stairs
if check_tile(elalien.hab,elalien.x+4,elalien.y+16)==tiletype.block then
elalien.goup=true
@@ -101,7 +101,7 @@ function elalien.update_normal()
end
if check_tile(elalien.hab,elalien.x+4,elalien.y+16)==tiletype.void and ((elalien.x+4)&7==0 or check_tile(elalien.hab,elalien.x+12,elalien.y+16)==tiletype.void) then
local option=rnd(2)
local option=math.random(0,1)
if elalien.stairscooldown>0 then option=0 end
if option==0 then
elalien.update=elalien.update_falling
@@ -223,19 +223,13 @@ 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
elalien.y=elalien.y-2
else
elalien.update=elalien.update_normal
if rnd(3)>0 then elalien.flip=not elalien.flip end
if math.random(0,2)>0 then elalien.flip=not elalien.flip end
elalien.stairscooldown=50
end
else
@@ -248,7 +242,7 @@ function elalien.update_stairs()
elalien.y=elalien.y+2
else
elalien.update=elalien.update_normal
if rnd(3)>0 then elalien.flip=not elalien.flip end
if math.random(0,2)>0 then elalien.flip=not elalien.flip end
elalien.stairscooldown=50
end
else

View File

@@ -8,7 +8,7 @@ fade = {
init = function()
for i=1,15 do
local r,g,b=getcolor(i)
local r,g,b=pal.color(i)
fade.pal[i]={r,g,b}
end
end,
@@ -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
@@ -48,14 +48,14 @@ fade = {
local v=fade.getstep(i,fade.step)
--print(v)
if v==16 then
setcolor(i,0,0,0)
pal.color(i,0,0,0)
else
setcolor(i,fade.pal[v][1],fade.pal[v][2],fade.pal[v][3])
pal.color(i,fade.pal[v][1],fade.pal[v][2],fade.pal[v][3])
end
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,11 +66,11 @@ 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
for i=1,15 do pal.color(i,0,0,0) end
end,
update_fadein=function()
@@ -84,14 +84,14 @@ fade = {
local v=fade.getstep(i,fade.step)
--print(v)
if v==16 then
setcolor(i,0,0,0)
pal.color(i,0,0,0)
else
setcolor(i,fade.pal[v][1],fade.pal[v][2],fade.pal[v][3])
pal.color(i,fade.pal[v][1],fade.pal[v][2],fade.pal[v][3])
end
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,42 +6,33 @@ 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)
setcolor(17,r,g,b)
music.play(audio_final)
local r,g,b=pal.color(15)
pal.color(17,r,g,b)
--fade.fadein()
end
go_next_actor=false
function update_final()
cls(16)
surf.cls(16)
camera(-16,-41)
view.origin(16,41)
mapa_draw(final_room)
draw_actor()
camera(0,0)
view.origin(0,0)
rectfill(0,0,14,96,16)
rectfill(114,0,191,96,16)
rect(15,40,113,89,2)
draw.rectf(0,0,15,97,16)
draw.rectf(114,0,78,97,16)
draw.rect(15,40,99,50,2)
text("C A C A U S", 42, 12, 17)
text(actor.name, 64-(#actor.name*2), 28, 11)
mapa_update(abad.hab,final_room)
if btnp(KEY_M) then
mute = not mute
if mute then
stopmusic()
else
playmus(audio_final)
end
end
if go_next_actor then next_actor() end
end
@@ -81,7 +72,7 @@ function draw_actor()
end
end
if current_actor==7 then
actor.y=28-abs(sin(actor.x*0.1))*24
actor.y=28-math.abs(math.sin(actor.x*0.1))*24
end
if actor.x>96 or actor.x<-actor.w or (#actor.anim==1 and actor.center_count==0) then
@@ -92,7 +83,7 @@ function draw_actor()
end
end
local tpl=128/actor.w
sspr((actor.frame%tpl)*actor.w,flr(actor.frame/tpl)*actor.h,actor.w,actor.h,actor.x,actor.y,actor.w,actor.h,actor.flip)
draw.surf((actor.frame%tpl)*actor.w,math.floor(actor.frame/tpl)*actor.h,actor.w,actor.h,actor.x,actor.y,actor.w,actor.h,actor.flip)
end
function next_actor()
@@ -128,7 +119,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]
@@ -136,21 +127,14 @@ function next_actor()
end
function update_final2()
cls(16)
surf.cls(16)
text("C A C A U S", 42, 12, 17)
text("GRACIES PER JUGAR", 30, 48, 10)
if btnp(KEY_M) then
mute = not mute
if mute then
stopmusic()
else
playmus(audio_final)
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 (key.press(keyShoot) or pad.press(btnShoot)) or key.press(key.RETURN) then
game_exit()
game_init(true)
fade.fadeoutin()
end

View File

@@ -8,13 +8,13 @@ function fireball.init(_hab,_x,_y,_flip)
fireball.flip=_flip
end
function fireball:draw()
circfill(fireball.x,fireball.y,3,16)
circfill(fireball.x,fireball.y,2,3)
circfill(fireball.x,fireball.y,1,8)
function fireball.draw()
draw.circf(fireball.x,fireball.y,3,16)
draw.circf(fireball.x,fireball.y,2,3)
draw.circf(fireball.x,fireball.y,1,8)
end
function fireball:update()
function fireball.update()
if fireball.hab == -1 then return end
fireball.wait=fireball.wait+1

5
data/game.ini Normal file
View File

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

646
data/game.lua Normal file
View File

@@ -0,0 +1,646 @@
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
mode=modes.playing
seltile = 0
actors={}
cameras={}
camera_names={[0]="GPS","Gorro","Peu de Paco","Premiere","EL_ALIEN","BatMan"}
current_camera=0
function remove_actor(actor)
for index, value in pairs(actors) do
if value == actor then
table.remove(actors,index)
end
end
end
function game_init(menu)
actors={}
cameras={}
camera_names={[0]="GPS","Gorro","Peu de Paco","Premiere","EL_ALIEN","BatMan"}
current_camera=0
-- ACTORS PRINCIPALS
abad_init()
table.insert(actors,abad)
gps.init()
table.insert(actors,gps)
gorro.init()
table.insert(actors,gorro)
peu.init()
table.insert(actors,peu)
premiere.init()
table.insert(actors,premiere)
elalien.init()
table.insert(actors,elalien)
batman.init()
table.insert(actors,batman)
bol.init()
table.insert(actors,bol)
-- MALOTES PERSISTENTS
table.insert(actors,gota.new(70,40,8,20))
table.insert(actors,gota.new(70,72,8,30))
table.insert(actors,gota.new(63,40,4,25))
table.insert(actors,gota.new(63,72,4,20))
table.insert(actors,gota.new(64,24,4,10))
table.insert(actors,gota.new(64,48,4,25))
table.insert(actors,gota.new(65,56,4,10))
table.insert(actors,gota.new(65,63,4,25))
table.insert(actors,gota.new(66,24,4,10))
table.insert(actors,gota.new(66,32,4,15))
table.insert(actors,gota.new(77,16,4,30))
table.insert(actors,gota.new(77,72,4,25))
table.insert(actors,invisible.new(77,40,32))
table.insert(actors,invisible.new(77,48,32))
table.insert(actors,invisible.new(58,16,32))
table.insert(actors,invisible.new(58,16,32))
table.insert(actors,zombie.new(2,24,24,false))
table.insert(actors,caco.new(13,24,16,true))
table.insert(actors,caco.new(20,24,16,false))
table.insert(actors,zombie.new(32,24,24,false))
table.insert(actors,caco.new(41,24,16,false))
table.insert(actors,zombie.new(44,24,24,false))
table.insert(actors,caco.new(50,24,16,false))
table.insert(actors,caco.new(61,24,16,false))
table.insert(actors,zombie.new(73,24,24,false))
table.insert(actors,zombie.new(54,24,24,false))
table.insert(actors,zombie.new(68,24,24,false))
table.insert(actors,caco.new(57,24,16,false))
table.insert(actors,zombie.new(46,24,24,false))
table.insert(actors,caco.new(37,24,16,false))
table.insert(actors,caco.new(26,24,16,false))
table.insert(actors,zombie.new(28,24,24,false))
table.insert(actors,caco.new(17,24,16,false))
-- TRIGGERS
if not menu then table.insert(actors,trigger.new(10,57,32,triggers.escena_abad_inici)) end
table.insert(actors,trigger.new(11,16,32,triggers.escena_abad_corfes))
table.insert(actors,trigger.new(31,12,32,triggers.escena_abad_portes))
table.insert(actors,trigger.new(31,48,32,triggers.escena_abad_portes))
table.insert(actors,trigger.new(71,56,24,triggers.escena_abad_portes))
table.insert(actors,trigger.new(53,40,32,triggers.escena_abad_porta_casa))
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))
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)
table.insert(cameras,premiere)
table.insert(cameras,elalien)
table.insert(cameras,batman)
mapa_do_backup()
if menu then
menu_sel=0
menu_state=update_main_menu;
abad.update = abad_nop
game_update=update_menu
menu_count=0
menu_change_room=300
menu_room=math.random(0,59)
music.play(audio_main_song)
else
game_update=update_game
music.stop()
end
--fade.fadein()
end
function draw_hab(hab,x,y,editing)
view.origin(x,y)
mapa_draw(hab)
if not editing then
for key,actor in pairs(actors) do
if actor.hab==hab then
actor:draw()
end
end
if imp.hab==hab then imp.draw() end
if bambolla.hab==hab then bambolla.draw() end
if cacau.hab==hab then cacau:draw() end
if fireball.hab==hab then fireball:draw() end
end
view.origin(0,0)
end
function update_dialog()
draw.rectf(16,16,97,35,12)
draw.rect(15,15,99,37,16)
text("Save the map?",20,20,2)
text("This cannot be undone",20,27,2)
text("(Y)es (N)o",25,40,2)
if key.press(key.N) then
game_update=update_game
elseif key.press(key.Y) then
mapa_save()
game_update=update_game
end
end
scroll=0
function update_game()
surf.cls(16)
if mode==modes.editing then
draw_hab(abad.hab,0,0,true)
text(abad.hab,120,1,2)
draw.surf(0,64+scroll*8,128,48,0,48)
local xx=(seltile&15)*8
local yy=48+(seltile>>4)*8
draw.rect(xx,yy,9,9, 3)
text("EDIT",100,1,3)
local hx = abad.hab%10
local hy = math.floor(abad.hab/10)
scroll=0
if key.press(key.RIGHT) and hx<9 then
abad.hab=abad.hab+1
elseif key.press(key.LEFT) and hx>0 then
abad.hab=abad.hab-1
elseif key.press(key.DOWN) and hy<7 then
abad.hab=abad.hab+10
elseif key.press(key.UP) and hy>0 then
abad.hab=abad.hab-10
elseif key.press(key.RETURN) then
mode=modes.playing
elseif key.press(key.S) and (key.down(key.LCTRL) or key.down(key.LGUI)) then
game_update=update_dialog
elseif key.press(key.C) then
mapa_cycle_colors(abad.hab)
elseif key.press(key.M) then
mapa_create_minimap()
return
end
if key.down(key.TAB) then
scroll=2
end
local mx,my=mouse.pos()
if mx>>3 < 12 and my>>3 < 6 then
text(mx>>3,100,10,2)
text(my>>3,111,10,2)
text((mx>>3)+(my>>3)*12,118,10,2)
end
if mouse.down(mouse.LEFT) then
if my>=48 then
seltile=(mx>>3)+((my-48+(scroll*8))>>3)*16
elseif mx<96 then
mapa_set_tile(abad.hab,mx>>3,my>>3,seltile)
end
elseif mouse.down(mouse.RIGHT) then
if my<48 and mx<96 then
mapa_set_tile(abad.hab,mx>>3,my>>3,256)
end
end
if mx>>3 < 12 and my>>3 < 6 then
local tx,ty=(mx>>3)<<3,(my>>3)<<3
draw.rect(tx,ty,9,9,3)
end
else
if abad.hurting == 0 then
draw_hab(abad.hab,0,0)
--text(abad.hab,1,1,2)
draw_hab(cameras[current_camera].hab,0,48)
text(camera_names[current_camera],2,49,8)
score.draw()
surf.source(tiles)
draw.text("x"..abad.vides,114,13,2)
draw.rectf(102+(abad.energia>>1),30,21-(abad.energia>>1),8,16)
else
draw.surf(0,0,16,9,50,40,16,9,true)
if abad.hurting > 40 then
draw.text("x"..abad.vides+1,63,43,3)
elseif abad.hurting < 20 then
draw.text("x"..abad.vides,63,43,2)
end
end
mapa_update(abad.hab,cameras[current_camera].hab)
for key,actor in pairs(actors) do
actor:update()
if actor.hab==cacau.hab and actor~=abad then
if aabb(actor,cacau) then
if actor.hit~=nil then
actor:hit()
cacau.hab=-1
end
end
end
end
imp.update()
bambolla.update()
cacau.update()
fireball.update()
switches.update()
if key.press(key.ESCAPE) or pad.press(btnPause) then
pause()
end
if abad.objects.gps~=nil then
if key.press(key.N1) then
if abad.objects.gorro==nil and abad.objects.clau_premiere==nil then current_camera=1 end
elseif key.press(key.N2) then
if abad.objects.peu==nil and abad.objects.clau_elalien==nil then current_camera=2 end
elseif key.press(key.N3) then
current_camera=3
elseif key.press(key.N4) then
current_camera=4
elseif key.press(key.N5) then
current_camera=5
end
if pad.press(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 pad.press(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 redraw_menu_hab()
draw_hab(menu_room,16,41)
draw.rectf(0,0,15,97,16)
draw.rectf(114,0,78,97,16)
draw.rect(15,40,99,50,2)
mapa_update(abad.hab,menu_room)
for key,actor in pairs(actors) do
actor:update()
end
imp.update()
bambolla.update()
cacau.update()
fireball.update()
switches.update()
end
function update_menu()
menu_change_room=menu_change_room-1
if menu_change_room==0 then
menu_room = math.random(0,59)
menu_change_room=300
end
surf.cls(16)
text("C A C A U S", 42, 8, 15)
menu_state()
end
function update_options_menu()
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
draw.rect(28,28+(10*menu_sel),73,9,14)
if (not parpadeig) then draw.rect(28,28+(10*menu_sel),73,9,13) end
draw.text("MÚSICA", 30, 30, 14); draw.text(music.enabled() and "SI" or "NO",91,30,15)
draw.text("", 30, 40, 14); draw.text(sound.enabled() and "SI" or "NO",91,40,15)
draw.text("REDEFINIR TECLAT", 30, 50, 14)
draw.text("REDEFINIR GAMEPAD", 30, 60, 14)
draw.text("TORNAR", 30, 70, 14)
if key.press(keyShoot) or key.press(key.SPACE) or pad.press(pad.A) or pad.press(btnShoot) then
if menu_sel==0 then
music.enabled(not music.enabled())
if music.enabled() then music.play(audio_main_song) end
elseif menu_sel==1 then
sound.enabled(not sound.enabled())
elseif menu_sel==2 then
menu_count=0
menu_state=update_redefine_keys_menu
elseif menu_sel==3 then
menu_count=0
menu_state=update_redefine_pad_menu
else
menu_count=0
menu_sel=0
menu_state=update_main_menu
end
elseif key.press(keyDown) or key.press(key.DOWN) or pad.press(pad.DOWN) or pad.press(btnDown) then
menu_sel=menu_sel+1
if menu_sel==5 then menu_sel=0 end
elseif key.press(keyUp) or key.press(key.UP) or pad.press(pad.UP) or pad.press(btnUp) then
menu_sel=menu_sel-1
if menu_sel==-1 then menu_sel=4 end
elseif key.press(key.ESCAPE) or pad.press(btnPause) then
menu_count=0
menu_sel=0
menu_state=update_main_menu
end
end
function update_main_menu()
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
draw.rect(28,18+(10*menu_sel),73,9,14)
if (not parpadeig) then draw.rect(28,18+(10*menu_sel),73,9,13) end
text("JUGAR", 54, 20, 14)
text("OPCIONS", 50, 30, 14)
--if (not parpadeig or menu_sel~=2) then text("REDEFINIR GAMEPAD", 30, 32, 13) end
redraw_menu_hab()
if key.press(keyShoot) or key.press(key.SPACE) or pad.press(pad.A) or pad.press(btnShoot) then
if menu_sel==0 then
game_exit()
game_init()
fade.fadeoutin()
elseif menu_sel==1 then
menu_count=0
menu_sel=0
menu_state=update_options_menu--update_redefine_keys_menu;
else
menu_count=0
menu_state=update_redefine_pad_menu
end
elseif key.press(keyDown) or key.press(key.DOWN) or pad.press(pad.DOWN) or pad.press(btnDown) then
menu_sel=menu_sel+1
if menu_sel==2 then menu_sel=0 end
elseif key.press(keyUp) or key.press(key.UP) or pad.press(pad.UP) or pad.press(btnUp) then
menu_sel=menu_sel-1
if menu_sel==-1 then menu_sel=1 end
elseif key.press(key.ESCAPE) or pad.press(btnPause) then
sys.quit()
end
end
function update_redefine_keys_menu()
if key.press(key.ESCAPE) then
menu_count = 0
menu_state = update_options_menu;
end
if menu_count==0 then
text("PULSA TECLA PER A AMUNT", 20, 24, 13)
local k = key.press();
if k ~= 0 and k~=key.ESCAPE then
menu_count = 1
keyUp=k
config.key("keyup", keyUp)
end
elseif menu_count==1 then
text("PULSA TECLA PER A AVALL", 20, 24, 13)
local k = key.press();
if k ~= 0 and k~=key.ESCAPE then
menu_count = 2
keyDown=k
config.key("keydown", keyDown)
end
elseif menu_count==2 then
text("PULSA TECLA PER A ESQUERRA", 14, 24, 13)
local k = key.press();
if k ~= 0 and k~=key.ESCAPE then
menu_count = 3
keyLeft=k
config.key("keleft", keyLeft)
end
elseif menu_count==3 then
text("PULSA TECLA PER A DRETA", 20, 24, 13)
local k = key.press();
if k ~= 0 and k~=key.ESCAPE then
menu_count = 4
keyRight=k
config.key("keyright", keyRight)
end
elseif menu_count==4 then
text("PULSA TECLA PER A BOTAR", 20, 24, 13)
local k = key.press();
if k ~= 0 and k~=key.ESCAPE then
menu_count = 5
keyJump=k
config.key("keyjump", keyJump)
end
elseif menu_count==5 then
text("PULSA TECLA PER A DISPAR", 18, 24, 13)
local k = key.press();
if k ~= 0 and k~=key.ESCAPE then
menu_count = 0
menu_state = update_options_menu;
keyShoot=k
config.key("keyshoot", keyShoot)
end
end
end
function update_redefine_pad_menu()
if key.press(key.ESCAPE) then
menu_count = 0
menu_state = update_options_menu;
end
if menu_count==0 then
text("PULSA BOTÓ PER A AMUNT", 22, 24, 13)
local btn = pad.press();
if btn ~= -1 then
menu_count = 1
btnUp=btn
config.key("btnup", btnUp)
end
elseif menu_count==1 then
text("PULSA BOTÓ PER A AVALL", 22, 24, 13)
local btn = pad.press();
if btn ~= -1 then
menu_count = 2
btnDown=btn
config.key("btndown", btnDown)
end
elseif menu_count==2 then
text("PULSA BOTÓ PER A ESQUERRA", 16, 24, 13)
local btn = pad.press();
if btn ~= -1 then
menu_count = 3
btnLeft=btn
config.key("keleft", btnLeft)
end
elseif menu_count==3 then
text("PULSA BOTÓ PER A DRETA", 22, 24, 13)
local btn = pad.press();
if btn ~= -1 then
menu_count = 4
btnRight=btn
config.key("btnright", btnRight)
end
elseif menu_count==4 then
text("PULSA BOTÓ PER A BOTAR", 22, 24, 13)
local btn = pad.press();
if btn ~= -1 then
menu_count = 5
btnJump=btn
config.key("btnjump", btnJump)
end
elseif menu_count==5 then
text("PULSA BOTÓ PER A DISPAR", 20, 24, 13)
local btn = pad.press();
if btn ~= -1 then
menu_count = 6
btnShoot=btn
config.key("btnshoot", btnShoot)
end
elseif menu_count==6 then
text("PULSA BOTÓ PER A GPS ARRERE", 14, 24, 13)
local btn = pad.press();
if btn ~= -1 then
menu_count = 7
btnCycle1=btn
config.key("btncycle1", btnCycle1)
end
elseif menu_count==7 then
text("PULSA BOTÓ PER A GPS AVANT", 14, 24, 13)
local btn = pad.press();
if btn ~= -1 then
menu_count = 8
btnCycle2=btn
config.key("btncycle2", btnCycle2)
end
elseif menu_count==8 then
text("PULSA BOTÓ PER A PAUSA", 22, 24, 13)
local btn = pad.press();
if btn ~= -1 then
menu_count = 0
menu_state = update_options_menu;
btnPause=btn
config.key("btnpause", btnPause)
end
end
end
function game_exit()
mapa_restore_backup()
actors={}
cameras={}
end
function aabb(a, b)
return (a.x+a.bb.x+a.bb.w >= b.x+b.bb.x) and (a.x+a.bb.x <= b.x+b.bb.x+b.bb.w) and (a.y+a.bb.y+a.bb.h >= b.y+b.bb.y) and (a.y+a.bb.y <= b.y+b.bb.y+b.bb.h)
end
function pause()
surf.source(0)
surf.target(back)
draw.surf(0,0,128,96,0,0)
surf.target(0)
surf.source(tiles)
pausa_option=1
pause_old_update=game_update
game_update=update_pause
end
function update_pause()
draw.rectf(16,16,97,65,16)
draw.rect(16,16,97,65,15)
draw.text("PAUSA",54,20,15)
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
draw.rect(28,33+(10*(pausa_option-1)),73,9,14)
if (not parpadeig) then draw.rect(28,33+(10*(pausa_option-1)),73,9,13) end
--draw.rect(28,33+(10*(pausa_option-1)),73,9,13)
draw.text("CONTINUAR",30,35,14)
draw.text("MUSICA:",30,45,14)
if music.enabled() then
draw.text("SI",91,45,15)
else
draw.text("NO",91,45,15)
end
draw.text("SÓ:",30,55,14)
if sound.enabled() then
draw.text("SI",91,55,15)
else
draw.text("NO",91,55,15)
end
draw.text("EIXIR",30,65,14)
if key.press(key.ESCAPE) then
surf.source(back)
draw.surf(0,0,128,96,0,0)
surf.source(tiles)
game_update = pause_old_update
elseif key.press(keyDown) or pad.press(btnDown) then
pausa_option = pausa_option + 1
if pausa_option == 5 then pausa_option = 1 end
elseif key.press(keyUp) or pad.press(btnUp) then
pausa_option = pausa_option - 1
if pausa_option == 0 then pausa_option = 4 end
elseif key.press(keyShoot) or pad.press(btnShoot) then
if pausa_option==1 then
surf.source(back)
draw.surf(0,0,128,96,0,0)
surf.source(tiles)
game_update = pause_old_update
elseif pausa_option==2 then
music.enabled(not music.enabled())
elseif pausa_option==3 then
sound.enabled(not sound.enabled())
else
game_exit()
game_init(true)
end
end
end

View File

@@ -2,7 +2,7 @@ gorro={hab=5,x=48,y=24,bb={x=0,y=0,w=8,h=8}}
function gorro.init()
local habs={{60,5},{4,5},{34,4},{62,7},{75,4}}
local r=1+rnd(#habs)
local r=1+math.random(0,#habs-1)
gorro.hab=habs[r][1]
gorro.x=habs[r][2]*8
gorro.update=gorro.update
@@ -10,7 +10,7 @@ function gorro.init()
end
function gorro.draw()
sspr(96,32,16,16,gorro.x,gorro.y,16,16)
draw.surf(96,32,16,16,gorro.x,gorro.y,16,16)
end
function gorro.update()

View File

@@ -5,7 +5,7 @@ function gota.new(_hab,_x,_y,_freq)
end
function gota:draw_normal()
sspr(112,0,8,8,self.x,self.y)
draw.surf(112,0,8,8,self.x,self.y)
end
function gota:update_normal()
@@ -22,7 +22,7 @@ function gota:update_normal()
self.cx=self.x+2
self.dx=0
self.dy=-4
if self.hab==abad.hab then playsnd(audio_low) end
if self.hab==abad.hab then sound.play(audio_low) end
end
else
--self.flip=not self.flip
@@ -46,14 +46,14 @@ function gota:hit()
end
function gota:draw_splash()
circfill(self.cx+self.dx,self.y,2,16)
circfill(self.cx+self.dx,self.y,1,11)
circfill(self.cx-self.dx,self.y,2,16)
circfill(self.cx-self.dx,self.y,1,11)
circfill(self.cx-(self.dx/2),self.y-4,2,16)
circfill(self.cx-(self.dx/2),self.y-4,1,11)
circfill(self.cx+(self.dx/2),self.y-4,2,16)
circfill(self.cx+(self.dx/2),self.y-4,1,11)
draw.circf(self.cx+self.dx,self.y,2,16)
draw.circf(self.cx+self.dx,self.y,1,11)
draw.circf(self.cx-self.dx,self.y,2,16)
draw.circf(self.cx-self.dx,self.y,1,11)
draw.circf(self.cx-(self.dx/2),self.y-4,2,16)
draw.circf(self.cx-(self.dx/2),self.y-4,1,11)
draw.circf(self.cx+(self.dx/2),self.y-4,2,16)
draw.circf(self.cx+(self.dx/2),self.y-4,1,11)
end
function gota:update_splash()

View File

@@ -2,7 +2,7 @@ gps={hab=5,x=48,y=24,bb={x=0,y=0,w=8,h=8}}
function gps.init()
local habs={{33,8},{13,4},{51,9},{50,4},{42,7}}
local r=1+rnd(#habs)
local r=1+math.random(0,#habs-1)
gps.hab=habs[r][1]
gps.x=habs[r][2]*8
gps.update=gps.update
@@ -10,7 +10,7 @@ function gps.init()
end
function gps.draw()
sspr(112,48,16,16,gps.x,gps.y,16,16)
draw.surf(112,48,16,16,gps.x,gps.y,16,16)
end
function gps.update()

View File

@@ -44,7 +44,7 @@ end
function imp.draw()
if imp.enabled then
sspr((imp.frame&7)*16,(imp.frame>>3)*16,16,16,imp.x,imp.y,16,16,imp.flip)
draw.surf((imp.frame&7)*16,(imp.frame>>3)*16,16,16,imp.x,imp.y,16,16,imp.flip)
end
end
@@ -58,7 +58,7 @@ function imp.update()
imp.wait=0
if not imp.enabled then
imp.counter=imp.counter-1
local r = rnd(imp.counter)
local r = math.random(0,imp.counter-1)
--print(r)
if imp.counter==1 or r==1 then
imp.init()
@@ -73,7 +73,7 @@ function imp.update()
imp.x=imp.x-2
if imp.x==78 then
fireball.init(imp.hab,imp.x+8,imp.y+4,imp.flip)
playsnd(audio_hit)
sound.play(audio_hit)
imp.flip=not imp.flip
elseif imp.x==-12 then
imp.reset()
@@ -82,7 +82,7 @@ function imp.update()
imp.x=imp.x+2
if imp.x==4 then
fireball.init(imp.hab,imp.x+8,imp.y+4,imp.flip)
playsnd(audio_hit)
sound.play(audio_hit)
imp.flip=not imp.flip
elseif imp.x==92 then
imp.reset()

101
data/intro.lua Normal file
View File

@@ -0,0 +1,101 @@
require "fade"
require "game"
require "mapa"
require "scenes"
intro_wait=40
intro_step=0
function intro_init()
game_update = intro_intro
intro_wait=400
surf.cls(16)
surf.target(logo)
surf.cls(16)
draw.text("JAILGAMES",0,0,15)
surf.target(0)
surf.source(logo)
draw.surf(0,0,36,5,28,35,72,10)
surf.source(tiles)
fade.fadein()
end
function intro_intro()
--text("JAILGAMES",40,30,15)
text("presenta",48,50,14)
intro_wait=intro_wait-1
if intro_wait==0 or key.press(key.ESCAPE) or key.press(keyShoot) or pad.press(btnShoot) or pad.press(btnPause) then
intro_wait=1
game_update = intro_update
fade.fadeoutin()
end
end
function intro_update()
if key.press(key.ESCAPE) or pad.press(btnPause) then
game_init(true)
fade.fadeoutin()
elseif key.press(key.SPACE) then
intro_wait=1
end
intro_wait=intro_wait-1
if intro_wait==0 then
if intro_step==0 then
surf.cls(16)
draw.rect(15,3,99,51,2)
view.origin(16,4)
mapa_draw(10)
draw.rectf(73,24,7,16,16)
draw.surf(0,0,16,16,44,24,16,16,true)
view.origin(0,0)
intro_step=intro_step+1
elseif intro_step==1 then
start_scene(scenes.intro_01,58)
intro_step=intro_step+1
elseif intro_step==2 then
surf.cls(16)
draw.rect(15,3,99,51,2)
view.origin(16,4)
mapa_draw(10)
draw.rectf(73,24,7,16,16)
draw.surf(0,0,16,16,44,24,16,16,false)
view.origin(0,0)
intro_step=intro_step+1
elseif intro_step==3 then
start_scene(scenes.intro_02,58)
intro_step=intro_step+1
elseif intro_step==4 then
surf.cls(16)
draw.rect(15,3,99,51,2)
view.origin(16,4)
mapa_draw(10)
draw.rectf(73,24,7,16,16)
draw.surf(0,0,16,16,44,24,16,16,false)
draw.surf(112,88,16,8,76,32,16,8,true)
draw.surf(0,48,16,16,82,24,16,16,true)
view.origin(0,0)
intro_step=intro_step+1
elseif intro_step==5 then
start_scene(scenes.intro_03,58)
intro_step=intro_step+1
elseif intro_step==6 then
surf.cls(16)
draw.rect(15,3,99,51,2)
view.origin(16,4)
mapa_draw(10)
draw.rectf(73,24,7,16,16)
draw.surf(0,0,16,16,44,24,16,16,false)
view.origin(0,0)
intro_step=intro_step+1
elseif intro_step==7 then
start_scene(scenes.intro_04,58)
intro_step=intro_step+1
elseif intro_step==8 then
music.play(audio_main_song)
game_init(true)
fade.fadeoutin()
end
intro_wait=50
end
end

107
data/main.lua Normal file
View File

@@ -0,0 +1,107 @@
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 mini.init()
tiles=surf.load("tiles.gif")
surf.source(tiles)
local paleta=pal.load("tiles.gif")
pal.set(paleta)
logo=surf.new(36,5)
back=surf.new(128,96)
fade.init()
audio_text_abad = sound.load(audio_text_abad)
audio_text_premiere = sound.load(audio_text_premiere)
audio_text_elalien = sound.load(audio_text_elalien)
audio_text_batman = sound.load(audio_text_batman)
audio_abad_jump = sound.load(audio_abad_jump)
audio_abad_fall = sound.load(audio_abad_fall)
audio_abad_hit = sound.load(audio_abad_hit)
audio_abad_shot = sound.load(audio_abad_shot)
audio_abad_step[1] = sound.load(audio_abad_step[1])
audio_abad_step[2] = sound.load(audio_abad_step[2])
audio_abad_step[3] = sound.load(audio_abad_step[3])
audio_abad_step[4] = audio_abad_step[2]
audio_switch = sound.load(audio_switch)
audio_hit = sound.load(audio_hit)
audio_low = sound.load(audio_low)
keyUp = tonumber(config.key("keyup")) or key.UP
keyDown = tonumber(config.key("keydown")) or key.DOWN
keyLeft = tonumber(config.key("keyleft")) or key.LEFT
keyRight = tonumber(config.key("keyright")) or key.RIGHT
keyJump = tonumber(config.key("keyjump")) or key.UP
keyShoot = tonumber(config.key("keyshoot")) or key.SPACE
btnUp = tonumber(config.key("btnup")) or pad.UP
btnDown = tonumber(config.key("btndown")) or pad.DOWN
btnLeft = tonumber(config.key("btnleft")) or pad.LEFT
btnRight = tonumber(config.key("btnright")) or pad.RIGHT
btnJump = tonumber(config.key("btnjump")) or pad.B
btnShoot = tonumber(config.key("btnshoot")) or pad.A
btnCycle1 = tonumber(config.key("btncycle1")) or pad.RIGHTSHOULDER
btnCycle2 = tonumber(config.key("btncycle2")) or pad.LEFTSHOULDER
btnPause = tonumber(config.key("btnpause")) or pad.START
--game_init()
intro_init()
--final_init()
end
function mini.update()
if key.press(key.F1) then
win.zoom(win.zoom()-1)
elseif key.press(key.F2) then
win.zoom(win.zoom()+1)
elseif key.press(key.F3) then
local fs = win.fullscreen()
win.fullscreen(not fs)
win.cursor(fs)
end
if (game_update) then game_update() end
end
function text(str,x,y,col)
draw.text(str,x-1,y-1,16)
draw.text(str,x,y-1,16)
draw.text(str,x+1,y-1,16)
draw.text(str,x-1,y,16)
draw.text(str,x+1,y,16)
draw.text(str,x-1,y+1,16)
draw.text(str,x,y+1,16)
draw.text(str,x+1,y+1,16)
draw.text(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
@@ -47,7 +48,7 @@ function mapa_new()
end
function mapa_save()
file = io.open("data/map.lua", "w")
local file = io.open("data/map.lua", "w")
io.output(file)
io.write("mapa={\n")
for i=1,80 do
@@ -92,7 +93,7 @@ function mapa_draw(hab)
for tx=0,11 do
local tile=mapa[1+hab][1+tx+ty*12]
if tile~=256 and (tile<126 or mapa.step>4) then
sspr((tile&15)*8,64+(tile>>4)*8,8,8,tx*8,ty*8)
draw.surf((tile&15)*8,64+(tile>>4)*8,8,8,tx*8,ty*8)
end
end
end
@@ -124,8 +125,8 @@ function mapa_cycle_colors(hab)
end
function check_tile(hab,x,y)
local xx=min(11,max(0,flr(x/8)))
local yy=min(5,max(0,flr(y/8)))
local xx=math.min(11,math.max(0,math.floor(x/8)))
local yy=math.min(5,math.max(0,math.floor(y/8)))
--rect(xx*8,yy*8,xx*8+8,yy*8+8,3)
local tile=mapa_get_tile(hab,xx,yy)
@@ -147,8 +148,8 @@ end
pix={14,10,7,1,0,0,0,0,4,4,4,4,0,0,0,8,14,14,14,14,14,14,0,0,10,10,10,10,10,10,10,10,7,7,7,7,7,7,2,2,1,1,1,1,1,1,12,12,1,1,1,9,9,9,10,10,10,0,0,0,0,0,0,0}
function mapa_create_minimap()
minimap = newsurf(128,96)
setdest(minimap)
minimap = surf.new(128,96)
surf.target(minimap)
for h=0,79 do
for y=0,5 do
for x=0,11 do
@@ -157,18 +158,18 @@ function mapa_create_minimap()
print(x..","..y.."="..tile)
end
if tile<64 then
pset(x+(h%10)*12,y+flr(h/10)*6,pix[1+tile])
surf.pixel(x+(h%10)*12,y+math.floor(h/10)*6,pix[1+tile])
end
end
end
end
_update=mapa_draw_minimap
game_update=mapa_draw_minimap
end
function mapa_draw_minimap()
--print("HOLA")
setsource(minimap)
setdest(0)
cls(16)
sspr(0,0,128,96,0,0)
surf.source(minimap)
surf.target(0)
surf.cls(16)
draw.surf(0,0,128,96,0,0)
end

View File

@@ -2,7 +2,7 @@ peu={hab=5,x=48,y=24,bb={x=0,y=0,w=8,h=8}}
function peu.init()
local habs={{18,8},{16,2},{16,7},{15,5},{27,1},{27,10},{29,2},{38,8},{69,2},{79,3}}
local r=1+rnd(#habs)
local r=1+math.random(0,#habs-1)
peu.hab=habs[r][1]
peu.x=habs[r][2]*8
peu.update=peu.update
@@ -10,7 +10,7 @@ function peu.init()
end
function peu.draw()
sspr(112,32,16,16,peu.x,peu.y,16,16)
draw.surf(112,32,16,16,peu.x,peu.y,16,16)
end
function peu.update()

View File

@@ -10,11 +10,11 @@ function premiere.init()
premiere.scene_intro=false
premiere.scene_object=false
local habs={75,44,20,0}
premiere.hab=habs[1+rnd(4)]
premiere.hab=habs[1+math.random(0,3)]
end
function premiere.draw()
sspr((premiere.frame&7)*16,(premiere.frame>>3)*16,16,16,premiere.x,premiere.y,16,16,premiere.flip)
draw.surf((premiere.frame&7)*16,(premiere.frame>>3)*16,16,16,premiere.x,premiere.y,16,16,premiere.flip)
end
function premiere.hit()
@@ -145,8 +145,8 @@ function premiere.update_falling()
end
end
local xx=flr((premiere.x+4)/8)
local yy=flr((premiere.y+16)/8)
local xx=math.floor((premiere.x+4)/8)
local yy=math.floor((premiere.y+16)/8)
if premiere.y<32 then
if (premiere.y+16)&7==0 and (check_tile(premiere.hab,premiere.x+4,premiere.y+16)>=tiletype.half or ((premiere.x+4)&7~=0 and check_tile(premiere.hab,premiere.x+12,premiere.y+16)>=tiletype.half)) then

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?",""}},
@@ -129,7 +132,7 @@ function start_scene(scene,offset)
--bkg=newsurf(128,96)
--setdest(bkg)
--setsource(0)
--sspr(0,0,128,96,0,0)
--draw.surf(0,0,128,96,0,0)
--setsource(tiles)
--setdest(0)
scenes.current_scene=scene
@@ -141,59 +144,59 @@ 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)
music.play(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)
if snd=="abad" then
playsnd(audio_text_abad)
sound.play(audio_text_abad)
elseif snd=="batman" then
playsnd(audio_text_batman)
sound.play(audio_text_batman)
elseif snd=="premiere" then
playsnd(audio_text_premiere)
sound.play(audio_text_premiere)
elseif snd=="elalien" then
playsnd(audio_text_elalien)
sound.play(audio_text_elalien)
end
end
function draw_scene()
local txt_x = not scenes.current_scene[scenes.dnum].flip and 38 or 8
camera(0,-scenes.offset)
view.origin(0,scenes.offset)
if scenes.step==0 then
rectfill(0,16,128,17,12)
line(0,15,128,15,16)
line(0,18,128,18,16)
draw.rectf(0,16,129,2,12)
draw.line(0,15,128,15,16)
draw.line(0,18,128,18,16)
elseif scenes.step==1 then
rectfill(0,8,128,26,12)
line(0,7,128,7,16)
line(0,27,128,27,16)
draw.rectf(0,8,129,19,12)
draw.line(0,7,128,7,16)
draw.line(0,27,128,27,16)
elseif scenes.step==2 then
rectfill(0,0,128,34,12)
line(0,0,128,0,16)
line(0,34,128,34,16)
draw.rectf(0,0,129,35,12)
draw.line(0,0,128,0,16)
draw.line(0,34,128,34,16)
elseif scenes.step==3 then
if not scenes.current_scene[scenes.dnum].flip then
rectfill(8,12,31,23,16)
sspr(scenes.current_scene[scenes.dnum].x,scenes.current_scene[scenes.dnum].y,10,10,9,13,20,10)
draw.rectf(8,12,24,12,16)
draw.surf(scenes.current_scene[scenes.dnum].x,scenes.current_scene[scenes.dnum].y,10,10,9,13,20,10)
else
rectfill(97,12,120,23,16)
sspr(scenes.current_scene[scenes.dnum].x,scenes.current_scene[scenes.dnum].y,10,10,98,13,20,10,true)
draw.rectf(97,12,24,12,16)
draw.surf(scenes.current_scene[scenes.dnum].x,scenes.current_scene[scenes.dnum].y,10,10,98,13,20,10,true)
end
elseif scenes.step==4 then
if not scenes.current_scene[scenes.dnum].flip then
rectfill(8,7,31,28,16)
sspr(scenes.current_scene[scenes.dnum].x,scenes.current_scene[scenes.dnum].y,10,10,9,8,20,20)
draw.rectf(8,7,24,22,16)
draw.surf(scenes.current_scene[scenes.dnum].x,scenes.current_scene[scenes.dnum].y,10,10,9,8,20,20)
else
rectfill(97,7,120,28,16)
sspr(scenes.current_scene[scenes.dnum].x,scenes.current_scene[scenes.dnum].y,10,10,98,8,20,20,true)
draw.rectf(97,7,24,22,16)
draw.surf(scenes.current_scene[scenes.dnum].x,scenes.current_scene[scenes.dnum].y,10,10,98,8,20,20,true)
end
elseif scenes.step==5 then
text(string.sub(scenes.current_scene[scenes.dnum].text[1],1,scenes.char),txt_x,7,2)
if scenes.char<#scenes.current_scene[scenes.dnum].text[1] then
text(utf8.sub(scenes.current_scene[scenes.dnum].text[1],1,scenes.char),txt_x,7,2)
if scenes.char<utf8.len(scenes.current_scene[scenes.dnum].text[1]) then
scenes.step=scenes.step-1
scenes.char=scenes.char+1
playtext(scenes.current_scene[scenes.dnum].audio)
@@ -201,8 +204,8 @@ function draw_scene()
scenes.char=1
end
elseif scenes.step==6 then
text(string.sub(scenes.current_scene[scenes.dnum].text[2],1,scenes.char),txt_x,15,2)
if scenes.char<#scenes.current_scene[scenes.dnum].text[2] then
text(utf8.sub(scenes.current_scene[scenes.dnum].text[2],1,scenes.char),txt_x,15,2)
if scenes.char<utf8.len(scenes.current_scene[scenes.dnum].text[2]) then
scenes.step=scenes.step-1
scenes.char=scenes.char+1
playtext(scenes.current_scene[scenes.dnum].audio)
@@ -210,8 +213,8 @@ function draw_scene()
scenes.char=1
end
elseif scenes.step==7 then
text(string.sub(scenes.current_scene[scenes.dnum].text[3],1,scenes.char),txt_x,23,2)
if scenes.char<#scenes.current_scene[scenes.dnum].text[3] then
text(utf8.sub(scenes.current_scene[scenes.dnum].text[3],1,scenes.char),txt_x,23,2)
if scenes.char<utf8.len(scenes.current_scene[scenes.dnum].text[3]) then
scenes.step=scenes.step-1
scenes.char=scenes.char+1
playtext(scenes.current_scene[scenes.dnum].audio)
@@ -219,22 +222,22 @@ function draw_scene()
scenes.char=1
end
elseif scenes.step==8 then
rectfill(0,0,128,34,12)
line(0,0,128,0,16)
line(0,34,128,34,16)
draw.rectf(0,0,129,35,12)
draw.line(0,0,128,0,16)
draw.line(0,34,128,34,16)
if not scenes.current_scene[scenes.dnum].flip then
rectfill(8,7,31,28,16)
sspr(scenes.current_scene[scenes.dnum].x,scenes.current_scene[scenes.dnum].y,10,10,9,8,20,20)
draw.rectf(8,7,24,22,16)
draw.surf(scenes.current_scene[scenes.dnum].x,scenes.current_scene[scenes.dnum].y,10,10,9,8,20,20)
else
rectfill(97,7,120,28,16)
sspr(scenes.current_scene[scenes.dnum].x,scenes.current_scene[scenes.dnum].y,10,10,98,8,20,20,true)
draw.rectf(97,7,24,22,16)
draw.surf(scenes.current_scene[scenes.dnum].x,scenes.current_scene[scenes.dnum].y,10,10,98,8,20,20,true)
end
text(scenes.current_scene[scenes.dnum].text[1],txt_x,7,2)
text(scenes.current_scene[scenes.dnum].text[2],txt_x,15,2)
text(scenes.current_scene[scenes.dnum].text[3],txt_x,23,2)
end
if scenes.step<=8 then scenes.step=scenes.step+1 end
camera(0,0)
view.origin(0,0)
end
function update_scene()
@@ -243,50 +246,60 @@ 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
music.stop()
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 math.floor(sys.time()*2)%2==0 then
draw.surf(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
draw.rectf(118,56,8,6,12)
end
end
end
end
if btnp(KEY_ESCAPE) then
if (key.press(key.ESCAPE) or pad.press(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
end
if scenes.step>8 then
if key.press(keyShoot) or key.press(keyDown) or key.press(keyUp) or key.press(keyLeft) or key.press(keyRight) or key.press(key.RETURN) or
pad.press(btnShoot) or pad.press(btnDown) or pad.press(btnUp) or pad.press(btnLeft) or pad.press(btnRight) then
if scenes.dnum==#scenes.current_scene then
stopmusic()
music.stop()
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 key.press(keyShoot) or pad.press(btnShoot) then
scenes.step=8
end
end

43
data/score.lua Normal file
View File

@@ -0,0 +1,43 @@
score={}
function score.create()
score.surf=surf.new(32,96)
surf.target(score.surf)
surf.cls(16)
draw.surf(0,0,16,9,5,9,16,9,true)
draw.surf(32,64,8,8,0,0) draw.surf(48,72,8,8,8,0) draw.surf(48,72,8,8,16,0) draw.surf(40,64,8,8,24,0)
draw.surf(48,64,8,8,0,8) draw.surf(56,64,8,8,24,8) draw.surf(48,64,8,8,0,16) draw.surf(56,64,8,8,24,16)
draw.surf(32,64,8,8,0,24) draw.surf(48,72,8,8,8,24) draw.surf(48,72,8,8,16,24) draw.surf(40,64,8,8,24,24)
draw.surf(48,64,8,8,0,32) draw.surf(56,64,8,8,24,32)
draw.surf(32,64,8,8,0,40) draw.surf(48,72,8,8,8,40) draw.surf(48,72,8,8,16,40) draw.surf(40,64,8,8,24,40)
draw.surf(48,64,8,8,0,48) draw.surf(56,64,8,8,24,48) draw.surf(48,64,8,8,0,56) draw.surf(56,64,8,8,24,56)
draw.surf(48,64,8,8,0,64) draw.surf(56,64,8,8,24,64) --draw.surf(48,64,8,8,0,72) draw.surf(56,64,8,8,24,72)
draw.surf(32,64,8,8,0,72) draw.surf(48,72,8,8,8,72) draw.surf(48,72,8,8,16,72) draw.surf(40,64,8,8,24,72)
draw.surf(48,64,8,8,0,80) draw.surf(56,64,8,8,24,80) draw.surf(48,64,8,8,0,88) draw.surf(56,64,8,8,24,88)
draw.text("jail",6,77,2)
draw.text("games",8, 82,2)
draw.text("2023",9,89,1)
draw.rectf(06,30,2,8,03)
draw.rectf(09,30,2,8,08)
draw.rectf(12,30,2,8,08)
draw.rectf(15,30,2,8,10)
draw.rectf(18,30,2,8,10)
draw.rectf(21,30,2,8,10)
draw.rectf(24,30,2,8,10)
surf.target(0)
end
function score.draw()
surf.source(score.surf)
draw.surf(0,0,32,96,96,0)
surf.source(tiles)
if abad.objects.gorro~=nil then draw.surf(96,32,16,16,99,44) end
if abad.objects.peu~=nil then draw.surf(112,32,16,16,109,44) end
if abad.objects.gps~=nil then draw.surf(112,48,16,16,100,55) end
if abad.objects.clau_premiere~=nil then draw.surf(112,8,8,8,104,48) end
if abad.objects.clau_elalien~=nil then draw.surf(120,8,8,8,112,48) end
if abad.objects.bol~=nil then draw.surf(112,88,16,8,104,46) end
end

View File

@@ -24,7 +24,7 @@ function switches.start(hab,tile)
switches.current_index=2
switches.wait=0
switches.cooldown=60
playsnd(audio_switch)
sound.play(audio_switch)
end
function switches.update()

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
sound.play(audio_hit)
surf.cls(14)
imp.reset()
abad.hab=67
abad.x=24
end
function triggers:teleport_b()
if abad.teleport then
sound.play(audio_hit)
surf.cls(14)
imp.reset()
abad.hab=14
abad.x=16
end
end
function triggers:teleport_c()
abad.teleport2=true
sound.play(audio_hit)
surf.cls(14)
imp.reset()
abad.hab=61
abad.x=24
end
function triggers:teleport_d()
if abad.teleport2 then
sound.play(audio_hit)
surf.cls(14)
imp.reset()
abad.hab=29
abad.x=24
end
end

View File

@@ -5,7 +5,7 @@ function zombie.new(_hab,_x,_y,_flip)
end
function zombie:draw()
if self.frame>0 then sspr((self.frame&7)*16,(self.frame>>3)*16,16,16,self.x,self.y,16,16,self.flip) end
if self.frame>0 then draw.surf((self.frame&7)*16,(self.frame>>3)*16,16,16,self.x,self.y,16,16,self.flip) end
end
function zombie:update_normal()

View File

@@ -1,5 +0,0 @@
title=Cacaus
width=128
height=96
zoom=5
files=final.lua,fade.lua,audio.lua,dead.lua,scenes.lua,trigger.lua,score.lua,switches.lua,map.lua,mapa.lua,bol.lua,invisibl.lua,gota.lua,fireball.lua,cacau.lua,bambolla.lua,imp.lua,gps.lua,peu.lua,gorro.lua,batman.lua,elalien.lua,premiere.lua,caco.lua,zombie.lua,abad.lua,intro.lua,game.lua,main.lua

405
game.lua
View File

@@ -1,405 +0,0 @@
--hab=0
modes={playing=0,editing=1}
--mode=modes.editing
mode=modes.playing
seltile = 0
actors={}
cameras={}
camera_names={[0]="GPS","Gorro","Peu de Paco","Premiere","EL_ALIEN","BatMan"}
current_camera=0
mute=false
function remove_actor(actor)
for index, value in pairs(actors) do
if value == actor then
table.remove(actors,index)
end
end
end
function playmus(song,volume)
if not mute then
playmusic(song,volume)
end
end
function playsnd(sound,volume)
if not mute then
--print(sound)
playsound(sound,volume)
end
end
function game_init(menu)
actors={}
cameras={}
camera_names={[0]="GPS","Gorro","Peu de Paco","Premiere","EL_ALIEN","BatMan"}
current_camera=0
-- ACTORS PRINCIPALS
abad_init()
table.insert(actors,abad)
gps.init()
table.insert(actors,gps)
gorro.init()
table.insert(actors,gorro)
peu.init()
table.insert(actors,peu)
premiere.init()
table.insert(actors,premiere)
elalien.init()
table.insert(actors,elalien)
batman.init()
table.insert(actors,batman)
bol.init()
table.insert(actors,bol)
-- MALOTES PERSISTENTS
table.insert(actors,gota.new(70,40,8,20))
table.insert(actors,gota.new(70,72,8,30))
table.insert(actors,gota.new(63,40,4,25))
table.insert(actors,gota.new(63,72,4,20))
table.insert(actors,gota.new(64,24,4,10))
table.insert(actors,gota.new(64,48,4,25))
table.insert(actors,gota.new(65,56,4,10))
table.insert(actors,gota.new(65,63,4,25))
table.insert(actors,gota.new(66,24,4,10))
table.insert(actors,gota.new(66,32,4,15))
table.insert(actors,gota.new(77,16,4,30))
table.insert(actors,gota.new(77,72,4,25))
table.insert(actors,invisible.new(77,40,32))
table.insert(actors,invisible.new(77,48,32))
table.insert(actors,invisible.new(58,16,32))
table.insert(actors,invisible.new(58,16,32))
table.insert(actors,zombie.new(2,24,24,false))
table.insert(actors,caco.new(13,24,16,true))
table.insert(actors,caco.new(20,24,16,false))
table.insert(actors,zombie.new(32,24,24,false))
table.insert(actors,caco.new(41,24,16,false))
table.insert(actors,zombie.new(44,24,24,false))
table.insert(actors,caco.new(50,24,16,false))
table.insert(actors,caco.new(61,24,16,false))
table.insert(actors,zombie.new(73,24,24,false))
table.insert(actors,zombie.new(54,24,24,false))
table.insert(actors,zombie.new(68,24,24,false))
table.insert(actors,caco.new(57,24,16,false))
table.insert(actors,zombie.new(46,24,24,false))
table.insert(actors,caco.new(37,24,16,false))
table.insert(actors,caco.new(26,24,16,false))
table.insert(actors,zombie.new(28,24,24,false))
table.insert(actors,caco.new(17,24,16,false))
-- TRIGGERS
if not menu then table.insert(actors,trigger.new(10,57,32,triggers.escena_abad_inici)) end
table.insert(actors,trigger.new(11,16,32,triggers.escena_abad_corfes))
table.insert(actors,trigger.new(31,12,32,triggers.escena_abad_portes))
table.insert(actors,trigger.new(31,48,32,triggers.escena_abad_portes))
table.insert(actors,trigger.new(71,56,24,triggers.escena_abad_portes))
table.insert(actors,trigger.new(53,40,32,triggers.escena_abad_porta_casa))
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()
cameras[0]=gps
table.insert(cameras,gorro)
table.insert(cameras,peu)
table.insert(cameras,premiere)
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)
playmus(audio_main_song)
else
_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)
if not editing then
for key,actor in pairs(actors) do
if actor.hab==hab then
actor:draw()
end
end
if imp.hab==hab then imp.draw() end
if bambolla.hab==hab then bambolla.draw() end
if cacau.hab==hab then cacau:draw() end
if fireball.hab==hab then fireball:draw() end
end
camera(0,0)
end
function update_dialog()
rectfill(16,16,112,50,12)
rect(15,15,113,51,16)
text("Save the map?",20,20,2)
text("This cannot be undone",20,27,2)
text("(Y)es (N)o",25,40,2)
if btnp(KEY_N) then
_update=update_game
elseif btnp(KEY_Y) then
mapa_save()
_update=update_game
end
end
scroll=0
function update_game()
cls(16)
if mode==modes.editing then
draw_hab(abad.hab,0,0,true)
text(abad.hab,120,1,2)
sspr(0,64+scroll*8,128,48,0,48)
color(3)
local xx=(seltile&15)*8
local yy=48+(seltile>>4)*8
rect(xx,yy,xx+8,yy+8)
text("EDIT",100,1,3)
local hx = abad.hab%10
local hy = flr(abad.hab/10)
scroll=0
if btnp(KEY_RIGHT) and hx<9 then
abad.hab=abad.hab+1
elseif btnp(KEY_LEFT) and hx>0 then
abad.hab=abad.hab-1
elseif btnp(KEY_DOWN) and hy<7 then
abad.hab=abad.hab+10
elseif btnp(KEY_UP) and hy>0 then
abad.hab=abad.hab-10
elseif btnp(KEY_RETURN) then
mode=modes.playing
elseif btnp(KEY_S) and (btn(KEY_LCTRL) or btn(KEY_LGUI)) then
_update=update_dialog
elseif btnp(KEY_C) then
mapa_cycle_colors(abad.hab)
elseif btnp(KEY_M) then
mapa_create_minimap()
return
end
if btn(KEY_TAB) then
scroll=2
end
local mx,my=mousex(),mousey()
if mx>>3 < 12 and my>>3 < 6 then
text(mx>>3,100,10,2)
text(my>>3,111,10,2)
text((mx>>3)+(my>>3)*12,118,10,2)
end
if mbtn(1) then
if my>=48 then
seltile=(mx>>3)+((my-48+(scroll*8))>>3)*16
elseif mx<96 then
mapa_set_tile(abad.hab,mx>>3,my>>3,seltile)
end
elseif mbtn(3) then
if my<48 and mx<96 then
mapa_set_tile(abad.hab,mx>>3,my>>3,256)
end
end
if mx>>3 < 12 and my>>3 < 6 then
local tx,ty=(mx>>3)<<3,(my>>3)<<3
rect(tx,ty,tx+8,ty+8,3)
end
else
if abad.hurting == 0 then
draw_hab(abad.hab,0,0)
--text(abad.hab,1,1,2)
draw_hab(cameras[current_camera].hab,0,48)
text(camera_names[current_camera],2,49,8)
score.draw()
setsource(tiles)
prnt("x"..abad.vides,114,13,2)
rectfill(102+(abad.energia>>1),30,122,37,16)
else
sspr(0,0,16,9,50,40,16,9,true)
if abad.hurting > 40 then
prnt("x"..abad.vides+1,63,43,3)
elseif abad.hurting < 20 then
prnt("x"..abad.vides,63,43,2)
end
end
mapa_update(abad.hab,cameras[current_camera].hab)
for key,actor in pairs(actors) do
actor:update()
if actor.hab==cacau.hab and actor~=abad then
if aabb(actor,cacau) then
if actor.hit~=nil then
actor:hit()
cacau.hab=-1
end
end
end
end
imp.update()
bambolla.update()
cacau.update()
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
pause()
end
if abad.objects.gps~=nil then
if btnp(KEY_1) then
if abad.objects.gorro==nil and abad.objects.clau_premiere==nil then current_camera=1 end
elseif btnp(KEY_2) then
if abad.objects.peu==nil and abad.objects.clau_elalien==nil then current_camera=2 end
elseif btnp(KEY_3) then
current_camera=3
elseif btnp(KEY_4) then
current_camera=4
elseif btnp(KEY_5) then
current_camera=5
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
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()
end
imp.update()
bambolla.update()
cacau.update()
fireball.update()
switches.update()
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)
end
end
end
function game_exit()
mapa_restore_backup()
actors={}
cameras={}
end
function aabb(a, b)
return (a.x+a.bb.x+a.bb.w >= b.x+b.bb.x) and (a.x+a.bb.x <= b.x+b.bb.x+b.bb.w) and (a.y+a.bb.y+a.bb.h >= b.y+b.bb.y) and (a.y+a.bb.y <= b.y+b.bb.y+b.bb.h)
end
function pause()
setsource(0)
setdest(back)
sspr(0,0,128,96,0,0)
setdest(0)
setsource(tiles)
pause_old_update=_update
_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 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)
end
end

101
intro.lua
View File

@@ -1,101 +0,0 @@
intro_wait=40
intro_step=0
function intro_init()
_update = intro_intro
intro_wait=400
cls(16)
setdest(logo)
cls(16)
prnt("JAILGAMES",0,0,15)
setdest(0)
setsource(logo)
sspr(0,0,36,5,28,35,72,10)
setsource(tiles)
fade.fadein()
end
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
intro_wait=1
_update = intro_update
fade.fadeoutin()
end
if btnp(KEY_M) then
mute = not mute
end
end
function intro_update()
if btnp(KEY_ESCAPE) then
game_init(true)
fade.fadeoutin()
elseif btnp(KEY_SPACE) then
intro_wait=1
elseif btnp(KEY_M) then
mute = not mute
end
intro_wait=intro_wait-1
if intro_wait==0 then
if intro_step==0 then
cls(16)
rect(15,3,113,53,2)
camera(-16,-4)
mapa_draw(10)
rectfill(73,24,79,39,16)
sspr(0,0,16,16,44,24,16,16,true)
camera(0,0)
intro_step=intro_step+1
elseif intro_step==1 then
start_scene(scenes.intro_01,58)
intro_step=intro_step+1
elseif intro_step==2 then
cls(16)
rect(15,3,113,53,2)
camera(-16,-4)
mapa_draw(10)
rectfill(73,24,79,39,16)
sspr(0,0,16,16,44,24,16,16,false)
camera(0,0)
intro_step=intro_step+1
elseif intro_step==3 then
start_scene(scenes.intro_02,58)
intro_step=intro_step+1
elseif intro_step==4 then
cls(16)
rect(15,3,113,53,2)
camera(-16,-4)
mapa_draw(10)
rectfill(73,24,79,39,16)
sspr(0,0,16,16,44,24,16,16,false)
sspr(112,88,16,8,76,32,16,8,true)
sspr(0,48,16,16,82,24,16,16,true)
camera(0,0)
intro_step=intro_step+1
elseif intro_step==5 then
start_scene(scenes.intro_03,58)
intro_step=intro_step+1
elseif intro_step==6 then
cls(16)
rect(15,3,113,53,2)
camera(-16,-4)
mapa_draw(10)
rectfill(73,24,79,39,16)
sspr(0,0,16,16,44,24,16,16,false)
camera(0,0)
intro_step=intro_step+1
elseif intro_step==7 then
start_scene(scenes.intro_04,58)
intro_step=intro_step+1
elseif intro_step==8 then
playmus(audio_main_song)
game_init(true)
fade.fadeoutin()
end
intro_wait=50
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

31
readme.md Normal file
View File

@@ -0,0 +1,31 @@
# Cacaus
<p align="center">
<img width="25%" height="25%" src="https://php.sustancia.synology.me/images/cacaus/cacaus0.jpg" alt="Títol" />
</p>
## Sinopsis
El Abad està feliç. Nit de Netflix amb un bon bol de cacaus... però els cacaus han desaparegut! Ja està Batman donant pel cul. Serà millor ficar-se a la feina. El Abad ja no està tan feliç.
<p align="center">
<img width="40%" height="40%" src="https://php.sustancia.synology.me/images/cacaus/cacaus1.jpg" alt="Cacaus" />&nbsp;&nbsp;&nbsp;&nbsp; <img width="40%" height="40%" src="https://php.sustancia.synology.me/images/cacaus/cacaus2.jpg" alt="Cacaus" />
</p>
Batman ha amagat els cacaus en la seua habitació. Tindrás que anar a sa casa i trobar-la. Però per a entrar et farà falta la clau! Segur que els teus amics et poden ajudar... si tu els ajudes abans!
Es un joc basat en el Spirits de Topo Soft.
## Instruccions
Hi ha diversos objectes i "persones" que has de trobar per a completar el joc, així que primer busca el GPS. Una vegada el tingues pulsa les tecles del 1 al 5 per a vore on està cada un dels objectes/persones.
Per a obrir les portes tindràs que trobar la palanca corresponent. A saber qui va ser l'inutil que va fer l'instalació elèctrica.
La casa s'ha omplit de monstres estrafalaris. A alguns els pots atontar momentaniament llençant-los una corfa de cacau. Altres passen de tot. Algúns es millor esquivar-los agaxant-se.
Ves espai i que no te toque Batman o te pegarà un carxot.
Quan obtingues la clau, recupera els cacaus de la seua habitació, busca a Batman i pega-li una bona cacauà.
<p align="center">
<img width="40%" height="40%" src="https://php.sustancia.synology.me/images/cacaus/cacaus3.jpg" alt="Cacaus" />&nbsp;&nbsp;&nbsp;&nbsp; <img width="40%" height="40%" src="https://php.sustancia.synology.me/images/cacaus/cacaus4.jpg" alt="Cacaus" />
</p>

View File

@@ -1,43 +0,0 @@
score={}
function score.create()
score.surf=newsurf(32,96)
setdest(score.surf)
cls(16)
sspr(0,0,16,9,5,9,16,9,true)
spr(132,0,0,1,1) spr(150,8,0,1,1) spr(150,16,0,1,1) spr(133,24,0,1,1)
spr(134,0,8,1,1) spr(135,24,8,1,1) spr(134,0,16,1,1) spr(135,24,16,1,1)
spr(132,0,24,1,1) spr(150,8,24,1,1) spr(150,16,24,1,1) spr(133,24,24,1,1)
spr(134,0,32,1,1) spr(135,24,32,1,1)
spr(132,0,40,1,1) spr(150,8,40,1,1) spr(150,16,40,1,1) spr(133,24,40,1,1)
spr(134,0,48,1,1) spr(135,24,48,1,1) spr(134,0,56,1,1) spr(135,24,56,1,1)
spr(134,0,64,1,1) spr(135,24,64,1,1) --spr(134,0,72,1,1) spr(135,24,72,1,1)
spr(132,0,72,1,1) spr(150,8,72,1,1) spr(150,16,72,1,1) spr(133,24,72,1,1)
spr(134,0,80,1,1) spr(135,24,80,1,1) spr(134,0,88,1,1) spr(135,24,88,1,1)
prnt("jail",6,77,2)
prnt("games",8,82,2)
prnt("2023",9,89,1)
rectfill(06,30,07,37,03)
rectfill(09,30,10,37,08)
rectfill(12,30,13,37,08)
rectfill(15,30,16,37,10)
rectfill(18,30,19,37,10)
rectfill(21,30,22,37,10)
rectfill(24,30,25,37,10)
setdest(0)
end
function score.draw()
setsource(score.surf)
sspr(0,0,32,96,96,0)
setsource(tiles)
if abad.objects.gorro~=nil then sspr(96,32,16,16,99,44) end
if abad.objects.peu~=nil then sspr(112,32,16,16,109,44) end
if abad.objects.gps~=nil then sspr(112,48,16,16,100,55) end
if abad.objects.clau_premiere~=nil then sspr(112,8,8,8,104,48) end
if abad.objects.clau_elalien~=nil then sspr(120,8,8,8,112,48) end
if abad.objects.bol~=nil then sspr(112,88,16,8,104,46) end
end