36 Commits
v1.1 ... master

Author SHA1 Message Date
a03ac00c76 Actualizar readme.md 2026-03-22 18:43:22 +01:00
650ca21167 Canviada la font 2026-03-22 18:41:27 +01:00
42b97b1fd0 Eliminat un pixel que sobrava 2026-03-20 00:00:18 +01:00
8144bcec05 Factoritzada draw_escenari() en intro.lua 2026-03-18 13:06:01 +01:00
b0fa162d62 Modificat l'ull de l'abad a l'ajupir-se, factoritzat draw_photo() en scenes.lua, i canviat el config de game.ini 2026-03-18 12:37:17 +01:00
ff7614a1d4 Actualizar readme.md 2026-03-18 09:57:12 +01:00
e5f121ec4e Actualizar readme.md 2026-03-18 09:51:30 +01:00
25db5d7944 Hale! Acabatgit add .git add . Arreglada la porta que es veia a l'inici, dispar cacau, nou titol i no recorde que mes 2026-03-18 08:46:38 +01:00
78cc72c614 Falten 2 de Premiere. Go! 2026-03-17 23:11:35 +01:00
5b9b9aed6d Corregit bol, adaptat final, modificat Batman. Joc completament jugable. Falten 2 de Premiere i el Imp 2026-03-17 22:31:38 +01:00
9e6c50cd87 7 sprites left 2026-03-17 20:03:28 +01:00
1d2e72db47 Ja escriu el text on toca en les escenes gracies al JailDoc. Gota ja es mostra com toca. Modificats uns quants sprites i tiles mes. Ja en queden pocs 2026-03-17 18:10:54 +01:00
336deaafa9 Modificat el menu de Pausa amb la funció d'escriure text en gran 2026-03-16 23:24:00 +01:00
6304c6ff06 Canviades les funcions d'imprimir el text en la redifinició de teclat i gamepad 2026-03-16 23:11:44 +01:00
3a7fa45013 Afegida funció per a mostrar el text en gran en borde negre. Canviades algunes crides a text() per la nova arc_textB(). Alguns tiles nous 2026-03-16 23:02:49 +01:00
845989280b Eliminats dibuixats dobles en gorro i peu. El splash de la bambolla ja es veu com toca. Afegida funció per a escalar el text i modificades algunes crides a draw.text. Sprite del Abad nou i altres personatges i tiles upgradats també 2026-03-16 21:15:12 +01:00
319862df30 Ja se veuen be el gorro, el gps, el peu, el cacau, la fireball i el imp que eixia 'flipat' 2026-03-15 23:39:21 +01:00
5a2b418e5b Updatats els tiles de taulell als altres colors que faltaven que això era ràpid 2026-03-15 23:15:21 +01:00
d890da0a47 El joc ja quasi es jugable. Falten els cacaus, el dispar de l'imp i alguns ajustos de posicions d'elements 2026-03-15 23:00:25 +01:00
5f8e13706c Modificades les funcions draw de batman, caco, elalien, imp, premiere i zombie. El menú principal ja pareix que es veu be. Parametritzats els avatars que faltaven en scenes 2026-03-15 22:08:03 +01:00
ec3d0916e1 Alguns tiles + en 'HD' (ganes de perdre el temps -_-') 2026-03-15 20:20:40 +01:00
3aeaace63a Intro funcional i alguns tiles en 'HD' 2026-03-15 19:15:50 +01:00
6c6c5b62d6 Primera escena ajustada i Abad en 'HD' 2026-03-15 18:19:20 +01:00
3d9746b5f5 Doblada la resolució de la finestra i modificada la intro a 2x 2026-03-15 16:37:10 +01:00
ec6b2b3643 Actualitzat readme.md 2026-03-15 15:04:14 +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
33 changed files with 1436 additions and 712 deletions

130
data/X2_font.fnt Normal file
View File

@@ -0,0 +1,130 @@
bitmap=X2_font.gif
32: 0 0 6 10 0 0 #
33: 8 0 6 10 0 0 # !
34: 16 0 6 10 0 0 # "
35: 24 0 6 10 0 0 # #
36: 32 0 6 10 0 0 # $
37: 40 0 6 10 0 0 # %
38: 48 0 6 10 0 0 # &
39: 56 0 6 10 0 0 # '
40: 64 0 6 10 0 0 # (
41: 72 0 6 10 0 0 # )
42: 80 0 6 10 0 0 # *
43: 88 0 6 10 0 0 # +
44: 96 0 6 10 0 0 # ,
45: 104 0 6 10 0 0 # -
46: 112 0 6 10 0 0 # .
47: 120 0 6 10 0 0 # /
48: 0 12 6 10 0 0 # 0
49: 8 12 6 10 0 0 # 1
50: 16 12 6 10 0 0 # 2
51: 24 12 6 10 0 0 # 3
52: 32 12 6 10 0 0 # 4
53: 40 12 6 10 0 0 # 5
54: 48 12 6 10 0 0 # 6
55: 56 12 6 10 0 0 # 7
56: 64 12 6 10 0 0 # 8
57: 72 12 6 10 0 0 # 9
58: 80 12 6 10 0 0 # :
59: 88 12 6 10 0 0 # ;
60: 96 12 6 10 0 0 # <
61: 104 12 6 10 0 0 # =
62: 112 12 6 10 0 0 # >
63: 120 12 6 10 0 0 # ?
64: 0 24 6 10 0 0 # @
65: 8 24 6 10 0 0 # A
66: 16 24 6 10 0 0 # B
67: 24 24 6 10 0 0 # C
68: 32 24 6 10 0 0 # D
69: 40 24 6 10 0 0 # E
70: 48 24 6 10 0 0 # F
71: 56 24 6 10 0 0 # G
72: 64 24 6 10 0 0 # H
73: 72 24 6 10 0 0 # I
74: 80 24 6 10 0 0 # J
75: 88 24 6 10 0 0 # K
76: 96 24 6 10 0 0 # L
77: 103 24 7 10 0 0 # M
78: 112 24 6 10 0 0 # N
79: 120 24 6 10 0 0 # O
80: 0 36 6 10 0 0 # P
81: 8 36 6 10 0 0 # Q
82: 16 36 6 10 0 0 # R
83: 24 36 6 10 0 0 # S
84: 32 36 6 10 0 0 # T
85: 40 36 6 10 0 0 # U
86: 48 36 6 10 0 0 # V
87: 55 36 8 10 0 0 # W
88: 64 36 6 10 0 0 # X
89: 72 36 6 10 0 0 # Y
90: 80 36 6 10 0 0 # Z
91: 88 36 6 10 0 0 # [
92: 96 36 6 10 0 0 # \
93: 104 36 6 10 0 0 # ]
94: 112 36 6 10 0 0 # ^
95: 120 36 6 10 0 0 # _
96: 0 48 6 10 0 0 # `
97: 8 48 6 10 0 0 # a
98: 16 48 6 10 0 0 # b
99: 24 48 6 10 0 0 # c
100: 32 48 6 10 0 0 # d
101: 40 48 6 10 0 0 # e
102: 48 48 6 10 0 0 # f
103: 56 48 6 10 0 0 # g
104: 64 48 6 10 0 0 # h
105: 72 48 6 10 0 0 # i
106: 80 48 6 10 0 0 # j
107: 88 48 6 10 0 0 # k
108: 96 48 6 10 0 0 # l
109: 103 48 7 10 0 0 # m
110: 112 48 6 10 0 0 # n
111: 120 48 6 10 0 0 # o
112: 0 60 6 10 0 0 # p
113: 8 60 6 10 0 0 # q
114: 16 60 6 10 0 0 # r
115: 24 60 6 10 0 0 # s
116: 32 60 6 10 0 0 # t
117: 40 60 6 10 0 0 # u
118: 48 60 6 10 0 0 # v
119: 55 60 8 10 0 0 # w
120: 64 60 6 10 0 0 # x
121: 72 60 6 10 0 0 # y
122: 80 60 6 10 0 0 # z
123: 88 60 6 10 0 0 # {
124: 96 60 6 10 0 0 # |
125: 104 60 6 10 0 0 # }
126: 112 60 6 10 0 0 # ~
127: 120 60 6 10 0 0 # ⌂
# Extended characters
161: 0 72 6 10 0 # ¡
191: 8 72 6 10 0 # ¿
192: 16 72 6 16 6 # À
193: 24 72 6 16 6 # Á
200: 32 72 6 16 6 # È
201: 40 72 6 16 6 # É
204: 48 72 6 16 6 # Ì
205: 56 72 6 16 6 # Í
210: 64 72 6 16 6 # Ò
211: 72 72 6 16 6 # Ó
217: 80 72 6 16 6 # Ù
218: 88 72 6 16 6 # Ú
209: 96 72 6 14 4 # Ñ
241: 104 72 6 12 2 # ñ
199: 112 72 6 10 0 # Ç
231: 120 72 6 10 0 # ç
224: 0 90 6 14 4 # à
225: 8 90 6 14 4 # á
232: 16 90 6 14 4 # è
233: 24 90 6 14 4 # é
236: 32 90 6 14 4 # ì
237: 40 90 6 14 4 # í
242: 48 90 6 14 4 # ò
243: 56 90 6 14 4 # ó
249: 64 90 6 14 4 # ù
250: 72 90 6 14 4 # ú

BIN
data/X2_font.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@@ -1,3 +1,11 @@
local arcade_config = require("arcade_config")
o2aX = arcade_config.org2arc_escala
cxr = arcade_config.character_per_row-1
cxr2 = arcade_config.character_per_row_base2
cw = arcade_config.character_width
ch = arcade_config.character_height
require "dead"
abad={x=40,y=24,flip=false,frame=1,wait=0,respawning=0,hab=10,vides=3,energia=40,falling=0,step=0, mustep=1,hurting=0,update=nil,jumpfwd=false,anim={0,1,0,2},bb={x=4,y=0,w=8,h=16},safe={hab=10,x=40,y=24}} abad={x=40,y=24,flip=false,frame=1,wait=0,respawning=0,hab=10,vides=3,energia=40,falling=0,step=0, mustep=1,hurting=0,update=nil,jumpfwd=false,anim={0,1,0,2},bb={x=4,y=0,w=8,h=16},safe={hab=10,x=40,y=24}}
@@ -16,8 +24,9 @@ function abad:draw()
if abad.update==abad_state_stairs then if abad.update==abad_state_stairs then
flip=(((abad.x>>1)+(abad.y>>1))%2)==0 flip=(((abad.x>>1)+(abad.y>>1))%2)==0
end end
if (abad.respawning==0) or (flr(abad.respawning/15)%2==0) then if (abad.respawning==0) or (math.floor(abad.respawning/15)%2==0) then
sspr(abad.frame*16,0,16,16,abad.x,abad.y,16,16,flip) -- draw.surf(abad.frame*16,0,16,16,abad.x,abad.y,16,16,flip)
draw.surf(abad.frame*cw,0,cw,ch,abad.x*o2aX,abad.y*o2aX,cw,ch,flip)
end end
if abad.respawning > 0 then if abad.respawning > 0 then
@@ -36,16 +45,17 @@ end
function abad_hurt(howmuch) function abad_hurt(howmuch)
if abad.hurting == 0 and abad.respawning==0 then if abad.hurting == 0 and abad.respawning==0 then
playsnd(audio_abad_hit) sound.play(audio_abad_hit)
abad.energia=abad.energia-howmuch abad.energia=abad.energia-howmuch
-- abad.energia=abad.energia
if abad.energia<=0 then if abad.energia<=0 then
abad.vides=abad.vides-1 abad.vides=abad.vides-1
if abad.vides==0 then if abad.vides==0 then
--final de la partida --final de la partida
dead.start() dead.start()
playmus(audio_game_over,0) music.play(audio_game_over,0)
else else
playmus(audio_life_lost,0) music.play(audio_life_lost,0)
abad.energia=40 abad.energia=40
abad.hab=abad.safe.hab abad.hab=abad.safe.hab
abad.x=abad.safe.x abad.x=abad.safe.x
@@ -55,10 +65,10 @@ function abad_hurt(howmuch)
abad.bb.y=0 abad.bb.y=0
abad.bb.h=16 abad.bb.h=16
abad.respawning=240 abad.respawning=240
cls(3) surf.cls(3)
end end
else else
cls(3) surf.cls(3)
end end
end end
end end
@@ -81,27 +91,27 @@ function abad_state_normal()
end end
abad_make_safe() abad_make_safe()
if btn(keyRight) or pad(btnRight) then if key.down(keyRight) or pad.down(btnRight) then
abad.update=abad_state_walking abad.update=abad_state_walking
abad.flip=false abad.flip=false
elseif btn(keyLeft) or pad(btnLeft) then elseif key.down(keyLeft) or pad.down(btnLeft) then
abad.update=abad_state_walking abad.update=abad_state_walking
abad.flip=true abad.flip=true
elseif btn(keyJump) or pad(btnJump) then elseif key.down(keyJump) or pad.down(btnJump) then
abad.update=abad_state_jumping abad.update=abad_state_jumping
abad.step=0 abad.step=0
abad.jumpfwd=false abad.jumpfwd=false
if abad.jump then if abad.jump then
stopsound(abad.jump) sound.stop(abad.jump)
abad.jump=nil abad.jump=nil
end end
playsnd(audio_abad_jump) sound.play(audio_abad_jump)
elseif btn(keyDown) or pad(btnDown) then elseif key.down(keyDown) or pad.down(btnDown) then
abad.update=abad_state_crouch abad.update=abad_state_crouch
--elseif btn(KEY_Z) then --elseif btn(KEY_Z) then
-- abad.respawning=240 -- abad.respawning=240
elseif btn(keyShoot) or pad(btnShoot) and cacau.hab==-1 then elseif key.down(keyShoot) or pad.down(btnShoot) and cacau.hab==-1 then
playsnd(audio_abad_shot) sound.play(audio_abad_shot)
abad.update=abad_state_fire abad.update=abad_state_fire
abad.wait=0 abad.wait=0
cacau.init(abad.hab,abad.x+8,abad.y+8,abad.flip) cacau.init(abad.hab,abad.x+8,abad.y+8,abad.flip)
@@ -116,7 +126,7 @@ function abad_state_crouch()
abad.step=0 abad.step=0
abad.jumpfwd=false abad.jumpfwd=false
if not (btn(keyDown) or pad(btnDown)) then if not (key.down(keyDown) or pad.down(btnDown)) then
abad.update=abad_state_normal abad.update=abad_state_normal
abad.bb.y=0 abad.bb.y=0
abad.bb.h=16 abad.bb.h=16
@@ -169,7 +179,7 @@ function abad_state_walking()
abad.wait=0 abad.wait=0
abad.step=(abad.step+1)%2 abad.step=(abad.step+1)%2
if abad.step==0 then 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 abad.mustep = abad.mustep + 1
if abad.mustep == 5 then abad.mustep=1 end if abad.mustep == 5 then abad.mustep=1 end
end end
@@ -185,28 +195,28 @@ function abad_state_walking()
abad_make_safe() abad_make_safe()
if btn(keyJump) or pad(btnJump) then if key.down(keyJump) or pad.down(btnJump) then
abad.update=abad_state_jumping abad.update=abad_state_jumping
abad.step=0 abad.step=0
abad.jumpfwd=true abad.jumpfwd=true
if abad.jump then if abad.jump then
stopsound(abad.jump) sound.stop(abad.jump)
abad.jump=nil abad.jump=nil
end end
playsnd(audio_abad_jump) sound.play(audio_abad_jump)
return return
elseif btn(keyDown) or pad(btnDown) then elseif key.down(keyDown) or pad.down(btnDown) then
abad.update=abad_state_crouch abad.update=abad_state_crouch
elseif btn(keyShoot) or pad(btnShoot) and cacau.hab==-1 then elseif key.down(keyShoot) or pad.down(btnShoot) and cacau.hab==-1 then
playsnd(audio_abad_shot) sound.play(audio_abad_shot)
abad.update=abad_state_fire abad.update=abad_state_fire
abad.wait=0 abad.wait=0
cacau.init(abad.hab,abad.x+8,abad.y+8,abad.flip) cacau.init(abad.hab,abad.x+8,abad.y+8,abad.flip)
end end
if btn(keyRight) or pad(btnRight) then if key.down(keyRight) or pad.down(btnRight) then
abad.flip=false abad.flip=false
elseif btn(keyLeft) or pad(btnLeft) then elseif key.down(keyLeft) or pad.down(btnLeft) then
abad.flip=true abad.flip=true
elseif abad.wait==0 then elseif abad.wait==0 then
abad.update=abad_state_normal abad.update=abad_state_normal
@@ -224,8 +234,8 @@ function abad_state_jumping()
if abad.jumpfwd then abad_advance() end if abad.jumpfwd then abad_advance() end
--local xx=flr((abad.x+4)/8) --local xx=math.floor((abad.x+4)/8)
--local yy=flr(abad.y/8) --local yy=math.floor(abad.y/8)
--rect(xx*8,yy*8, (xx+2)*8,(yy+1)*8) --rect(xx*8,yy*8, (xx+2)*8,(yy+1)*8)
if abad.step<6 then if abad.step<6 then
if abad.y>0 then if abad.y>0 then
@@ -234,14 +244,14 @@ function abad_state_jumping()
if check_tile(abad.hab,abad.x+4,abad.y-2)==tiletype.switch then if check_tile(abad.hab,abad.x+4,abad.y-2)==tiletype.switch then
-- Executar el switch -- Executar el switch
local xx=min(11,max(0,flr((abad.x+4)/8))) local xx=math.min(11,math.max(0,math.floor((abad.x+4)/8)))
local yy=min(5,max(0,flr((abad.y-2)/8))) local yy=math.min(5,math.max(0,math.floor((abad.y-2)/8)))
switches.start(abad.hab,1+xx+yy*12) switches.start(abad.hab,1+xx+yy*12)
--cls(4) --cls(4)
elseif (abad.x+4)&7~=0 and check_tile(abad.hab,abad.x+12,abad.y-2)==tiletype.switch then elseif (abad.x+4)&7~=0 and check_tile(abad.hab,abad.x+12,abad.y-2)==tiletype.switch then
-- Executar el switch -- Executar el switch
local xx=min(11,max(0,flr((abad.x+12)/8))) local xx=math.min(11,math.max(0,math.floor((abad.x+12)/8)))
local yy=min(5,max(0,flr((abad.y-2)/8))) local yy=math.min(5,math.max(0,math.floor((abad.y-2)/8)))
switches.start(abad.hab,1+xx+yy*12) switches.start(abad.hab,1+xx+yy*12)
--cls(4) --cls(4)
else else
@@ -256,7 +266,7 @@ function abad_state_jumping()
end end
elseif abad.step>6 then elseif abad.step>6 then
abad.update=abad_state_falling abad.update=abad_state_falling
abad.jump=playsnd(audio_abad_fall) abad.jump=sound.play(audio_abad_fall)
end end
abad.step=abad.step+1 abad.step=abad.step+1
end end
@@ -272,8 +282,8 @@ function abad_state_falling()
if abad.jumpfwd then abad_advance() end if abad.jumpfwd then abad_advance() end
local xx=flr((abad.x+4)/8) local xx=math.floor((abad.x+4)/8)
local yy=flr((abad.y+16)/8) local yy=math.floor((abad.y+16)/8)
if abad.y<32 then 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 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
@@ -297,30 +307,30 @@ function abad_state_stairs()
if abad.wait==6 then if abad.wait==6 then
abad.wait=0 abad.wait=0
if btn(keyRight) or pad(btnRight) then if key.down(keyRight) or pad.down(btnRight) then
abad.flip=false abad.flip=false
abad_advance() abad_advance()
playsnd(audio_low) sound.play(audio_low)
elseif btn(keyLeft) or pad(btnLeft) then elseif key.down(keyLeft) or pad.down(btnLeft) then
abad.flip=true abad.flip=true
abad_advance() abad_advance()
playsnd(audio_low) sound.play(audio_low)
elseif btn(keyUp) or pad(btnUp) then elseif key.down(keyUp) or pad.down(btnUp) then
if abad.y>0 then if abad.y>0 then
if check_tile(abad.hab,abad.x+4,abad.y+8)==tiletype.stair or (abad.x+4)&7~=0 and check_tile(abad.hab,abad.x+12,abad.y+8)==tiletype.stair then if check_tile(abad.hab,abad.x+4,abad.y+8)==tiletype.stair or (abad.x+4)&7~=0 and check_tile(abad.hab,abad.x+12,abad.y+8)==tiletype.stair then
abad.y=abad.y-2 abad.y=abad.y-2
playsnd(audio_low) sound.play(audio_low)
end end
else else
abad.hab=abad.hab-10 abad.hab=abad.hab-10
imp.reset() imp.reset()
abad.y=32 abad.y=32
end end
elseif btn(keyDown) or pad(btnDown) then elseif key.down(keyDown) or pad.down(btnDown) then
if abad.y<32 then if abad.y<32 then
if check_tile(abad.hab,abad.x+4,abad.y+16)==tiletype.stair or (abad.x+4)&7~=0 and check_tile(abad.hab,abad.x+12,abad.y+16)==tiletype.stair then if check_tile(abad.hab,abad.x+4,abad.y+16)==tiletype.stair or (abad.x+4)&7~=0 and check_tile(abad.hab,abad.x+12,abad.y+16)==tiletype.stair then
abad.y=abad.y+2 abad.y=abad.y+2
playsnd(audio_low) sound.play(audio_low)
end end
else else
abad.hab=abad.hab+10 abad.hab=abad.hab+10

32
data/arcade_config.lua Normal file
View File

@@ -0,0 +1,32 @@
local arcade_config = {
org_resolucion = { width = 128, height = 96 },
resolucion = { width = 256, height = 192 },
surface = { width = 256, height = 192 },
logo_sf = { width = 144, height = 20 },
sprite_size = { w = 32, h = 32 },
escala = 1.0,
org2arc_escala = 2.0,
tiles_offset = 128,
tiles_per_row = 16,
tiles_per_row_base2 = 4,
tiles_width = 16,
tiles_height = 16,
character_per_row = 8,
character_per_row_base2 = 3,
character_width = 32,
character_height = 32,
fullscreen = false
}
-- Proteger contra creación/modificación accidental de campos no declarados
-- setmetatable(config, {
-- __newindex = function(t, k, v)
-- if rawget(t, k) == nil then
-- error("Intento de crear campo nuevo en config: "..tostring(k), 2)
-- else
-- rawset(t, k, v)
-- end
-- end
-- })
return arcade_config

View File

@@ -1,3 +1,12 @@
local arcade_config = require("arcade_config")
o2aX = arcade_config.org2arc_escala
cxr = arcade_config.character_per_row-1
cxr2 = arcade_config.character_per_row_base2
cw = arcade_config.character_width
ch = arcade_config.character_height
bambolla_gif_col = 7
bambolla_gif_row = 1
bambolla={hab=75,x=24,y=24,cx=0,dx=0,dy=0,flip=true,enabled=false,counter=800,wait=0,bb={x=4,y=4,w=8,h=8}} bambolla={hab=75,x=24,y=24,cx=0,dx=0,dy=0,flip=true,enabled=false,counter=800,wait=0,bb={x=4,y=4,w=8,h=8}}
function bambolla.reset() function bambolla.reset()
@@ -44,7 +53,8 @@ end
function bambolla.draw_normal() function bambolla.draw_normal()
if bambolla.enabled then 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)
draw.surf(bambolla_gif_col*cw,bambolla_gif_row*ch,cw,ch,bambolla.x*o2aX,bambolla.y*o2aX,cw,ch)
end end
end end
@@ -58,7 +68,7 @@ function bambolla.update_normal()
bambolla.wait=0 bambolla.wait=0
if not bambolla.enabled then if not bambolla.enabled then
bambolla.counter=bambolla.counter-1 bambolla.counter=bambolla.counter-1
local r = rnd(bambolla.counter) local r = math.random(0,bambolla.counter-1)
--print(r) --print(r)
if bambolla.counter==1 or r==1 then if bambolla.counter==1 or r==1 then
bambolla.init() bambolla.init()
@@ -77,9 +87,9 @@ function bambolla.update_normal()
bambolla.reset() bambolla.reset()
end end
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 if bambolla.hab==abad.hab and bambolla.y>25.2 then
playsnd(audio_low) sound.play(audio_low)
end end
if bambolla.hab==abad.hab then if bambolla.hab==abad.hab then
if cacau.hab==bambolla.hab and aabb(bambolla,cacau) then if cacau.hab==bambolla.hab and aabb(bambolla,cacau) then
@@ -89,7 +99,7 @@ function bambolla.update_normal()
bambolla.y=bambolla.y+8 bambolla.y=bambolla.y+8
bambolla.dx=0 bambolla.dx=0
bambolla.dy=-4 bambolla.dy=-4
playsnd(audio_hit) sound.play(audio_hit)
end end
if aabb(bambolla,abad) then if aabb(bambolla,abad) then
abad_hurt(1) abad_hurt(1)
@@ -109,14 +119,14 @@ bambolla.update=bambolla.update_normal
bambolla.draw=bambolla.draw_normal bambolla.draw=bambolla.draw_normal
function bambolla.draw_splash() function bambolla.draw_splash()
circfill(bambolla.cx+bambolla.dx,bambolla.y,2,16) draw.circf( (bambolla.cx-bambolla.dx)*o2aX, bambolla.y*o2aX, 1, 6)
circfill(bambolla.cx+bambolla.dx,bambolla.y,1,6) draw.circf( (bambolla.cx+bambolla.dx)*o2aX, bambolla.y*o2aX, 2, 16)
circfill(bambolla.cx-bambolla.dx,bambolla.y,2,16) draw.circf( (bambolla.cx+bambolla.dx)*o2aX, bambolla.y*o2aX, 1, 6)
circfill(bambolla.cx-bambolla.dx,bambolla.y,1,6) draw.circf( (bambolla.cx-bambolla.dx)*o2aX, bambolla.y*o2aX, 2, 16)
circfill(bambolla.cx-(bambolla.dx/2),bambolla.y-4,2,16) draw.circf( (bambolla.cx-(bambolla.dx/2))*o2aX, (bambolla.y-4)*o2aX, 2, 16)
circfill(bambolla.cx-(bambolla.dx/2),bambolla.y-4,1,6) draw.circf( (bambolla.cx-(bambolla.dx/2))*o2aX, (bambolla.y-4)*o2aX, 1, 6)
circfill(bambolla.cx+(bambolla.dx/2),bambolla.y-4,2,16) draw.circf( (bambolla.cx+(bambolla.dx/2))*o2aX, (bambolla.y-4)*o2aX, 2, 16)
circfill(bambolla.cx+(bambolla.dx/2),bambolla.y-4,1,6) draw.circf( (bambolla.cx+(bambolla.dx/2))*o2aX, (bambolla.y-4)*o2aX, 1, 6)
end end
function bambolla.update_splash() function bambolla.update_splash()

View File

@@ -1,3 +1,10 @@
local arcade_config = require("arcade_config")
o2aX = arcade_config.org2arc_escala
cxr = arcade_config.character_per_row-1
cxr2 = arcade_config.character_per_row_base2
cw = arcade_config.character_width
ch = arcade_config.character_height
batman={hab=5,x=24,y=24,flip=true,goup=true,frame=8,stairscooldown=0,stepscooldown=0,stepsremember=0,wait=0,step=0,anim={24,25,24,26},bb={x=4,y=0,w=8,h=16},scene_intro=false,scene_object=false} batman={hab=5,x=24,y=24,flip=true,goup=true,frame=8,stairscooldown=0,stepscooldown=0,stepsremember=0,wait=0,step=0,anim={24,25,24,26},bb={x=4,y=0,w=8,h=16},scene_intro=false,scene_object=false}
function batman.init() function batman.init()
@@ -5,7 +12,7 @@ function batman.init()
batman.update=batman.update_normal batman.update=batman.update_normal
batman.draw=batman.draw batman.draw=batman.draw
local habs={5,9,46,36,18} local habs={5,9,46,36,18}
batman.hab=habs[1+rnd(#habs)] batman.hab=habs[1+math.random(0,#habs-1)]
batman.x=24 batman.x=24
batman.y=24 batman.y=24
end end
@@ -15,7 +22,8 @@ function batman.draw()
if batman.update==batman.update_stairs then if batman.update==batman.update_stairs then
flip=(((batman.x>>1)+(batman.y>>1))%2)==0 flip=(((batman.x>>1)+(batman.y>>1))%2)==0
end 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)
draw.surf((batman.frame&7)*cw,(batman.frame>>cxr2)*ch,cw,ch,batman.x*o2aX,batman.y*o2aX,cw,ch,flip)
end end
function batman.hit() function batman.hit()
@@ -58,7 +66,7 @@ function batman.update_normal()
batman.x=84 batman.x=84
end end
elseif check_tile(batman.hab,batman.x+inc,batman.y+6)<tiletype.half then 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 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 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 if r==0 then
@@ -90,7 +98,7 @@ function batman.update_normal()
if batman.stairscooldown==0 and if batman.stairscooldown==0 and
check_tile(batman.hab,batman.x+6,batman.y+8)==tiletype.stair 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 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 batman.update=batman.update_stairs
if check_tile(batman.hab,batman.x+4,batman.y+16)==tiletype.block then if check_tile(batman.hab,batman.x+4,batman.y+16)==tiletype.block then
batman.goup=true batman.goup=true
@@ -108,7 +116,7 @@ function batman.update_normal()
end 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 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 batman.stairscooldown>0 then option=0 end
if option==0 then if option==0 then
batman.update=batman.update_falling batman.update=batman.update_falling
@@ -221,7 +229,7 @@ function batman.update_stairs()
batman.y=batman.y-2 batman.y=batman.y-2
else else
batman.update=batman.update_normal 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 batman.stairscooldown=50
end end
else else
@@ -234,7 +242,7 @@ function batman.update_stairs()
batman.y=batman.y+2 batman.y=batman.y+2
else else
batman.update=batman.update_normal 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 batman.stairscooldown=50
end end
else else

View File

@@ -1,3 +1,14 @@
local arcade_config = require("arcade_config")
o2aX = arcade_config.org2arc_escala
txr = arcade_config.tiles_per_row-1
txr2 = arcade_config.tiles_per_row_base2
toff = arcade_config.tiles_offset
tw = arcade_config.tiles_width
th = arcade_config.tiles_height
-- posició en el gif des de l'offset de tiles
bol_gif_col = 14
bol_gif_row = 3
bol={hab=39,x=28,y=25,bb={x=0,y=0,w=16,h=8}} bol={hab=39,x=28,y=25,bb={x=0,y=0,w=16,h=8}}
function bol.init() function bol.init()
@@ -6,7 +17,10 @@ function bol.init()
end end
function bol.draw() 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)
local x = bol_gif_col*tw
local y = toff+bol_gif_row*th
draw.surf(x,y,tw*2,th,bol.x*o2aX,bol.y*o2aX,tw*2,th)
end end
function bol.update() function bol.update()

View File

@@ -1,3 +1,6 @@
local arcade_config = require("arcade_config")
o2aX = arcade_config.org2arc_escala
cacau={hab=-1,x=0,y=0,wait=0,flip=false,bb={x=0,y=0,w=4,h=4}} cacau={hab=-1,x=0,y=0,wait=0,flip=false,bb={x=0,y=0,w=4,h=4}}
function cacau.init(_hab,_x,_y,_flip) function cacau.init(_hab,_x,_y,_flip)
@@ -8,12 +11,14 @@ function cacau.init(_hab,_x,_y,_flip)
cacau.flip=_flip cacau.flip=_flip
end end
function cacau:draw() function cacau.draw()
circfill(cacau.x,cacau.y,2,16) draw.circf(cacau.x*o2aX,cacau.y*o2aX,2*o2aX,16)
circfill(cacau.x,cacau.y,1,6) draw.circf((cacau.x+2)*o2aX,cacau.y*o2aX,2*o2aX,16)
draw.circf(cacau.x*o2aX,cacau.y*o2aX,1*o2aX,6)
draw.circf((cacau.x+2)*o2aX,cacau.y*o2aX,1*o2aX,6)
end end
function cacau:update() function cacau.update()
if cacau.hab == -1 then return end if cacau.hab == -1 then return end
cacau.wait=cacau.wait+1 cacau.wait=cacau.wait+1

View File

@@ -1,3 +1,10 @@
local arcade_config = require("arcade_config")
o2aX = arcade_config.org2arc_escala
cxr = arcade_config.character_per_row-1
cxr2 = arcade_config.character_per_row_base2
cw = arcade_config.character_width
ch = arcade_config.character_height
caco={} caco={}
function caco.new(_hab,_x,_y,_flip) function caco.new(_hab,_x,_y,_flip)
@@ -5,7 +12,8 @@ function caco.new(_hab,_x,_y,_flip)
end end
function caco:draw() 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
if self.frame>0 then draw.surf((self.frame&7)*cw,(self.frame>>cxr2)*ch,cw,ch,self.x*o2aX,self.y*o2aX,cw,ch,self.flip) end
end end
function caco:update_normal() function caco:update_normal()

View File

@@ -6,7 +6,7 @@ function dead.start()
dead.vel={} dead.vel={}
for i=1,128 do for i=1,128 do
dead.pos[i]=0 dead.pos[i]=0
dead.vel[i]=(200+rnd(400))/400 dead.vel[i]=(200+math.random(0,399))/400
end end
game_update=dead.update game_update=dead.update
end end
@@ -16,30 +16,30 @@ function dead.update()
for i=1,128 do for i=1,128 do
if dead.pos[i]<96 then if dead.pos[i]<96 then
dead.pos[i]=dead.pos[i]+dead.vel[i] 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
end end
if dead.count>50 then if dead.count>50 then
if dead.count>130 then if dead.count>130 then
prnt("GAME OVER",44,40,2) draw.text("GAME OVER",44,40,2)
elseif dead.count>120 then elseif dead.count>120 then
prnt("GAME OVE",44,40,2) draw.text("GAME OVE",44,40,2)
elseif dead.count>110 then elseif dead.count>110 then
prnt("GAME OV",44,40,2) draw.text("GAME OV",44,40,2)
elseif dead.count>100 then elseif dead.count>100 then
prnt("GAME O",44,40,2) draw.text("GAME O",44,40,2)
elseif dead.count>90 then elseif dead.count>90 then
prnt("GAME",44,40,2) draw.text("GAME",44,40,2)
elseif dead.count>80 then elseif dead.count>80 then
prnt("GAM",44,40,2) draw.text("GAM",44,40,2)
elseif dead.count>70 then elseif dead.count>70 then
prnt("GA",44,40,2) draw.text("GA",44,40,2)
elseif dead.count>60 then elseif dead.count>60 then
prnt("G",44,40,2) draw.text("G",44,40,2)
end end
end end
if (dead.count>250 and (btnp(keyShoot) or padp(btnShoot))) 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_exit()
game_init(true) game_init(true)
end end

View File

@@ -1,3 +1,10 @@
local arcade_config = require("arcade_config")
o2aX = arcade_config.org2arc_escala
cxr = arcade_config.character_per_row-1
cxr2 = arcade_config.character_per_row_base2
cw = arcade_config.character_width
ch = arcade_config.character_height
elalien={hab=66,x=24,y=24,flip=true,goup=true,frame=8,stairscooldown=0,wait=0,step=0,anim={8,9,8,10},bb={x=4,y=0,w=8,h=16},scene_intro=false,scene_object=false} elalien={hab=66,x=24,y=24,flip=true,goup=true,frame=8,stairscooldown=0,wait=0,step=0,anim={8,9,8,10},bb={x=4,y=0,w=8,h=16},scene_intro=false,scene_object=false}
function elalien.init() function elalien.init()
@@ -11,7 +18,7 @@ function elalien.init()
elalien.scene_intro=false elalien.scene_intro=false
elalien.scene_object=false elalien.scene_object=false
local habs={66,56,59,53} local habs={66,56,59,53}
elalien.hab=habs[1+rnd(4)] elalien.hab=habs[1+math.random(0,3)]
end end
function elalien.draw() function elalien.draw()
@@ -19,7 +26,7 @@ function elalien.draw()
if elalien.update==elalien.update_stairs then if elalien.update==elalien.update_stairs then
flip=(((elalien.x>>1)+(elalien.y>>1))%2)==0 flip=(((elalien.x>>1)+(elalien.y>>1))%2)==0
end end
sspr((elalien.frame&7)*16,(elalien.frame>>3)*16,16,16,elalien.x,elalien.y,16,16,flip) draw.surf((elalien.frame&7)*cw,(elalien.frame>>cxr2)*ch,cw,ch,elalien.x*o2aX,elalien.y*o2aX,cw,ch,flip)
end end
function elalien.hit() function elalien.hit()
@@ -56,7 +63,7 @@ function elalien.update_normal()
elalien.x=84 elalien.x=84
end end
elseif check_tile(elalien.hab,elalien.x+inc,elalien.y+6)<tiletype.half then 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 check_tile(elalien.hab,elalien.x+inc,elalien.y+14)==tiletype.block then r=0 end
if r==0 then if r==0 then
elalien.update=elalien.update_jumping elalien.update=elalien.update_jumping
@@ -83,7 +90,7 @@ function elalien.update_normal()
if elalien.stairscooldown==0 and if elalien.stairscooldown==0 and
check_tile(elalien.hab,elalien.x+6,elalien.y+8)==tiletype.stair 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 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 elalien.update=elalien.update_stairs
if check_tile(elalien.hab,elalien.x+4,elalien.y+16)==tiletype.block then if check_tile(elalien.hab,elalien.x+4,elalien.y+16)==tiletype.block then
elalien.goup=true elalien.goup=true
@@ -101,7 +108,7 @@ function elalien.update_normal()
end 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 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 elalien.stairscooldown>0 then option=0 end
if option==0 then if option==0 then
elalien.update=elalien.update_falling elalien.update=elalien.update_falling
@@ -229,7 +236,7 @@ function elalien.update_stairs()
elalien.y=elalien.y-2 elalien.y=elalien.y-2
else else
elalien.update=elalien.update_normal 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 elalien.stairscooldown=50
end end
else else
@@ -242,7 +249,7 @@ function elalien.update_stairs()
elalien.y=elalien.y+2 elalien.y=elalien.y+2
else else
elalien.update=elalien.update_normal 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 elalien.stairscooldown=50
end end
else else

View File

@@ -8,7 +8,7 @@ fade = {
init = function() init = function()
for i=1,15 do for i=1,15 do
local r,g,b=getcolor(i) local r,g,b=pal.color(i)
fade.pal[i]={r,g,b} fade.pal[i]={r,g,b}
end end
end, end,
@@ -48,9 +48,9 @@ fade = {
local v=fade.getstep(i,fade.step) local v=fade.getstep(i,fade.step)
--print(v) --print(v)
if v==16 then if v==16 then
setcolor(i,0,0,0) pal.color(i,0,0,0)
else 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
end end
fade.step=fade.step+1 fade.step=fade.step+1
@@ -70,7 +70,7 @@ fade = {
game_update=fade.update_fadein game_update=fade.update_fadein
fade.wait=0 fade.wait=0
fade.step=6 fade.step=6
for i=1,15 do setcolor(i,0,0,0) end for i=1,15 do pal.color(i,0,0,0) end
end, end,
update_fadein=function() update_fadein=function()
@@ -84,9 +84,9 @@ fade = {
local v=fade.getstep(i,fade.step) local v=fade.getstep(i,fade.step)
--print(v) --print(v)
if v==16 then if v==16 then
setcolor(i,0,0,0) pal.color(i,0,0,0)
else 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
end end
fade.step=fade.step-1 fade.step=fade.step-1

View File

@@ -1,3 +1,12 @@
require "logo"
local arcade_config = require("arcade_config")
o2aX = arcade_config.org2arc_escala
cxr = arcade_config.character_per_row-1
cxr2 = arcade_config.character_per_row_base2
cw = arcade_config.character_width
ch = arcade_config.character_height
final_rooms = {2,6,60,21,49,23,66,32,4,46,39,55,74} final_rooms = {2,6,60,21,49,23,66,32,4,46,39,55,74}
function final_init() function final_init()
@@ -8,40 +17,34 @@ function final_init()
abad.update = abad_nop abad.update = abad_nop
game_update=update_final game_update=update_final
next_actor() next_actor()
playmus(audio_final) music.play(audio_final)
local r,g,b=getcolor(15) local r,g,b=pal.color(15)
setcolor(17,r,g,b) pal.color(17,r,g,b)
--fade.fadein() --fade.fadein()
end end
go_next_actor=false go_next_actor=false
function update_final() function update_final()
cls(16) surf.cls(16)
camera(-16,-41) view.origin(16*o2aX,41*o2aX)
mapa_draw(final_room) mapa_draw(final_room)
draw_actor() draw_actor()
camera(0,0) view.origin(0,0)
rectfill(0,0,14,96,16) draw.rectf(0,0,15*o2aX,97*o2aX,16)
rectfill(114,0,191,96,16) draw.rectf(114*o2aX,0,78*o2aX,97*o2aX,16)
rect(15,40,113,89,2) draw.rect(15*o2aX,40*o2aX,99*o2aX,50*o2aX,2)
text("C A C A U S", 42, 12, 17) -- text("C A C A U S", 42, 12, 17)
text(actor.name, 64-(#actor.name*2), 28, 11) -- arc_textB("C A C A U S", 42*o2aX, 12*o2aX, 17)
draw_logo(14*o2aX, 10*o2aX)
-- text(actor.name, 64-(#actor.name*2), 28, 11)
arc_textB(actor.name, (64-(#actor.name*2))*o2aX, 28*o2aX, 11)
mapa_update(abad.hab,final_room) 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 if go_next_actor then next_actor() end
end end
@@ -81,7 +84,7 @@ function draw_actor()
end end
end end
if current_actor==7 then 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 end
if actor.x>96 or actor.x<-actor.w or (#actor.anim==1 and actor.center_count==0) then if actor.x>96 or actor.x<-actor.w or (#actor.anim==1 and actor.center_count==0) then
@@ -92,7 +95,8 @@ function draw_actor()
end end
end end
local tpl=128/actor.w 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)
draw.surf((actor.frame%tpl)*actor.w*o2aX, math.floor(actor.frame/tpl)*actor.h*o2aX ,actor.w*o2aX, actor.h*o2aX, actor.x*o2aX ,actor.y*o2aX ,actor.w*o2aX ,actor.h*o2aX, actor.flip)
end end
function next_actor() function next_actor()
@@ -136,21 +140,16 @@ function next_actor()
end end
function update_final2() function update_final2()
cls(16) surf.cls(16)
text("C A C A U S", 42, 12, 17) -- text("C A C A U S", 42, 12, 17)
text("GRACIES PER JUGAR", 30, 48, 10) -- arc_textB("C A C A U S", 42*o2aX, 12*o2aX, 17)
draw_logo(14*o2aX, 10*o2aX)
-- text("GRACIES PER JUGAR", 30, 48, 10)
arc_text("GRACIES PER JUGAR", 30*o2aX, 48*o2aX, 10)
if btnp(KEY_M) then
mute = not mute
if mute then
stopmusic()
else
playmus(audio_final)
end
end
final_count=final_count+1 final_count=final_count+1
if final_count==200 or (btnp(keyShoot) or padp(btnShoot)) 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_exit()
game_init(true) game_init(true)
fade.fadeoutin() fade.fadeoutin()

View File

@@ -1,3 +1,6 @@
local arcade_config = require("arcade_config")
o2aX = arcade_config.org2arc_escala
fireball={hab=-1,x=0,y=0,wait=0,flip=false,bb={x=0,y=0,w=4,h=4}} fireball={hab=-1,x=0,y=0,wait=0,flip=false,bb={x=0,y=0,w=4,h=4}}
function fireball.init(_hab,_x,_y,_flip) function fireball.init(_hab,_x,_y,_flip)
@@ -8,13 +11,13 @@ function fireball.init(_hab,_x,_y,_flip)
fireball.flip=_flip fireball.flip=_flip
end end
function fireball:draw() function fireball.draw()
circfill(fireball.x,fireball.y,3,16) draw.circf(fireball.x*o2aX,fireball.y*o2aX,3*o2aX,16)
circfill(fireball.x,fireball.y,2,3) draw.circf(fireball.x*o2aX,fireball.y*o2aX,2*o2aX,3)
circfill(fireball.x,fireball.y,1,8) draw.circf(fireball.x*o2aX,fireball.y*o2aX,1*o2aX,8)
end end
function fireball:update() function fireball.update()
if fireball.hab == -1 then return end if fireball.hab == -1 then return end
fireball.wait=fireball.wait+1 fireball.wait=fireball.wait+1

View File

@@ -1,6 +1,5 @@
title=Cacaus title=X2 Cacaus
config=cacaus config=x2cacaus
width=128 width=256
height=96 height=192
zoom=5 zoom=3
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

View File

@@ -1,4 +1,26 @@
--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"
require "logo"
local arcade_config = require("arcade_config")
o2aX = arcade_config.org2arc_escala
modes={playing=0,editing=1} modes={playing=0,editing=1}
--mode=modes.editing --mode=modes.editing
@@ -10,7 +32,6 @@ actors={}
cameras={} cameras={}
camera_names={[0]="GPS","Gorro","Peu de Paco","Premiere","EL_ALIEN","BatMan"} camera_names={[0]="GPS","Gorro","Peu de Paco","Premiere","EL_ALIEN","BatMan"}
current_camera=0 current_camera=0
mute=false
function remove_actor(actor) function remove_actor(actor)
for index, value in pairs(actors) do for index, value in pairs(actors) do
@@ -20,19 +41,6 @@ function remove_actor(actor)
end end
end end
function playmus(song,loop)
if not mute then
playmusic(song,loop)
end
end
function playsnd(sound,volume)
if not mute then
--print(sound)
return playsound(sound,volume)
end
end
function game_init(menu) function game_init(menu)
actors={} actors={}
cameras={} cameras={}
@@ -133,36 +141,22 @@ function game_init(menu)
if menu then if menu then
menu_sel=0 menu_sel=0
menu_state=0 menu_state=update_main_menu;
abad.update = abad_nop abad.update = abad_nop
game_update=update_menu game_update=update_menu
menu_count=0 menu_count=0
menu_change_room=300 menu_change_room=300
menu_room=rnd(60) menu_room=math.random(0,59)
playmus(audio_main_song) music.play(audio_main_song)
else else
game_update=update_game game_update=update_game
stopmusic() music.stop()
end end
--fade.fadein() --fade.fadein()
end end
function text(str,x,y,col)
color(16)
prnt(str,x-1,y-1)
prnt(str,x,y-1)
prnt(str,x+1,y-1)
prnt(str,x-1,y)
prnt(str,x+1,y)
prnt(str,x-1,y+1)
prnt(str,x,y+1)
prnt(str,x+1,y+1)
prnt(str,x,y,col)
end
function draw_hab(hab,x,y,editing) function draw_hab(hab,x,y,editing)
camera(-x,-y) view.origin(x*o2aX,y*o2aX)
mapa_draw(hab) mapa_draw(hab)
if not editing then if not editing then
@@ -176,19 +170,19 @@ function draw_hab(hab,x,y,editing)
if cacau.hab==hab then cacau:draw() end if cacau.hab==hab then cacau:draw() end
if fireball.hab==hab then fireball:draw() end if fireball.hab==hab then fireball:draw() end
end end
camera(0,0) view.origin(0,0)
end end
function update_dialog() function update_dialog()
rectfill(16,16,112,50,12) draw.rectf(16*o2aX,16*o2aX,97*o2aX,35*o2aX,12)
rect(15,15,113,51,16) draw.rect(15*o2aX,15*o2aX,99*o2aX,37*o2aX,16)
text("Save the map?",20,20,2) text("Save the map?",20*o2aX,20*o2aX,2)
text("This cannot be undone",20,27,2) text("This cannot be undone",20*o2aX,27*o2aX,2)
text("(Y)es (N)o",25,40,2) text("(Y)es (N)o",25*o2aX,40*o2aX,2)
if btnp(KEY_N) then if key.press(key.N) then
game_update=update_game game_update=update_game
elseif btnp(KEY_Y) then elseif key.press(key.Y) then
mapa_save() mapa_save()
game_update=update_game game_update=update_game
end end
@@ -196,81 +190,84 @@ end
scroll=0 scroll=0
function update_game() function update_game()
cls(16) surf.cls(16)
if mode==modes.editing then if mode==modes.editing then
draw_hab(abad.hab,0,0,true) draw_hab(abad.hab,0,0,true)
text(abad.hab,120,1,2) text(abad.hab,120*o2aX,1*o2aX,2)
sspr(0,64+scroll*8,128,48,0,48) draw.surf(0,(64+scroll*8)*o2aX,128*o2aX,48*o2aX,0,48*o2aX)
color(3)
local xx=(seltile&15)*8 local xx=(seltile&15)*8
local yy=48+(seltile>>4)*8 local yy=48+(seltile>>4)*8
rect(xx,yy,xx+8,yy+8) draw.rect(xx*o2aX,yy*o2aX,9*o2aX,9*o2aX, 3)
text("EDIT",100,1,3) text("EDIT",100*o2aX,1*o2aX,3)
local hx = abad.hab%10 local hx = abad.hab%10
local hy = flr(abad.hab/10) local hy = math.floor(abad.hab/10)
scroll=0 scroll=0
if btnp(KEY_RIGHT) and hx<9 then if key.press(key.RIGHT) and hx<9 then
abad.hab=abad.hab+1 abad.hab=abad.hab+1
elseif btnp(KEY_LEFT) and hx>0 then elseif key.press(key.LEFT) and hx>0 then
abad.hab=abad.hab-1 abad.hab=abad.hab-1
elseif btnp(KEY_DOWN) and hy<7 then elseif key.press(key.DOWN) and hy<7 then
abad.hab=abad.hab+10 abad.hab=abad.hab+10
elseif btnp(KEY_UP) and hy>0 then elseif key.press(key.UP) and hy>0 then
abad.hab=abad.hab-10 abad.hab=abad.hab-10
elseif btnp(KEY_RETURN) then elseif key.press(key.RETURN) then
mode=modes.playing mode=modes.playing
elseif btnp(KEY_S) and (btn(KEY_LCTRL) or btn(KEY_LGUI)) then elseif key.press(key.S) and (key.down(key.LCTRL) or key.down(key.LGUI)) then
game_update=update_dialog game_update=update_dialog
elseif btnp(KEY_C) then elseif key.press(key.C) then
mapa_cycle_colors(abad.hab) mapa_cycle_colors(abad.hab)
elseif btnp(KEY_M) then elseif key.press(key.M) then
mapa_create_minimap() mapa_create_minimap()
return return
end end
if btn(KEY_TAB) then if key.down(key.TAB) then
scroll=2 scroll=2
end end
local mx,my=mousex(),mousey() local mx,my=mouse.pos()
if mx>>3 < 12 and my>>3 < 6 then if mx>>3 < 12 and my>>3 < 6 then
text(mx>>3,100,10,2) text(mx>>3,100*o2aX,10*o2aX,2)
text(my>>3,111,10,2) text(my>>3,111*o2aX,10*o2aX,2)
text((mx>>3)+(my>>3)*12,118,10,2) text(((mx>>3)+(my>>3)*12)*o2aX,118*o2aX,10*o2aX,2)
end end
if mbtn(1) then if mouse.down(mouse.LEFT) then
if my>=48 then if my>=48 then
seltile=(mx>>3)+((my-48+(scroll*8))>>3)*16 seltile=(mx>>3)+((my-48+(scroll*8))>>3)*16
elseif mx<96 then elseif mx<96 then
mapa_set_tile(abad.hab,mx>>3,my>>3,seltile) mapa_set_tile(abad.hab,mx>>3,my>>3,seltile)
end end
elseif mbtn(3) then elseif mouse.down(mouse.RIGHT) then
if my<48 and mx<96 then if my<48 and mx<96 then
mapa_set_tile(abad.hab,mx>>3,my>>3,256) mapa_set_tile(abad.hab,mx>>3,my>>3,256)
end end
end end
if mx>>3 < 12 and my>>3 < 6 then if mx>>3 < 12 and my>>3 < 6 then
local tx,ty=(mx>>3)<<3,(my>>3)<<3 local tx,ty=(mx>>3)<<3,(my>>3)<<3
rect(tx,ty,tx+8,ty+8,3) draw.rect(tx*o2aX,ty*o2aX,9*o2aX,9*o2aX,3)
end end
else else
if abad.hurting == 0 then if abad.hurting == 0 then
draw_hab(abad.hab,0,0) draw_hab(abad.hab,0,0)
--text(abad.hab,1,1,2) --text(abad.hab,1,1,2)
draw_hab(cameras[current_camera].hab,0,48) draw_hab(cameras[current_camera].hab,0,48)
text(camera_names[current_camera],2,49,8) -- text(camera_names[current_camera],2*o2aX,49*o2aX,8)
arc_textB(camera_names[current_camera],2*o2aX,49*o2aX,8)
score.draw() score.draw()
setsource(tiles) surf.source(tiles)
prnt("x"..abad.vides,114,13,2) -- draw.text("x"..abad.vides,114*o2aX,13*o2aX,2)
rectfill(102+(abad.energia>>1),30,122,37,16) arc_text("x"..abad.vides,114*o2aX,13*o2aX,2)
draw.rectf((102+(abad.energia>>1))*o2aX,30*o2aX,(21-(abad.energia>>1))*o2aX,8*o2aX,16)
else else
sspr(0,0,16,9,50,40,16,9,true) draw.surf(0,0,16*o2aX,9*o2aX,50*o2aX,40*o2aX,16*o2aX,9*o2aX,true)
if abad.hurting > 40 then if abad.hurting > 40 then
prnt("x"..abad.vides+1,63,43,3) -- draw.text("x"..abad.vides+1,63*o2aX,43*o2aX,3)
arc_text("x"..abad.vides+1,63*o2aX,43*o2aX,3)
elseif abad.hurting < 20 then elseif abad.hurting < 20 then
prnt("x"..abad.vides,63,43,2) -- draw.text("x"..abad.vides,63*o2aX,43*o2aX,2)
arc_text("x"..abad.vides,63*o2aX,43*o2aX,2)
end end
end end
@@ -293,48 +290,41 @@ function update_game()
fireball.update() fireball.update()
switches.update() switches.update()
--local hx = abad.hab%10 if key.press(key.ESCAPE) or pad.press(btnPause) then
--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) then
pause() pause()
end end
if abad.objects.gps~=nil then if abad.objects.gps~=nil then
if btnp(KEY_1) then if key.press(key.N1) then
if abad.objects.gorro==nil and abad.objects.clau_premiere==nil then current_camera=1 end if abad.objects.gorro==nil and abad.objects.clau_premiere==nil then current_camera=1 end
elseif btnp(KEY_2) then elseif key.press(key.N2) then
if abad.objects.peu==nil and abad.objects.clau_elalien==nil then current_camera=2 end if abad.objects.peu==nil and abad.objects.clau_elalien==nil then current_camera=2 end
elseif btnp(KEY_3) then elseif key.press(key.N3) then
current_camera=3 current_camera=3
elseif btnp(KEY_4) then elseif key.press(key.N4) then
current_camera=4 current_camera=4
elseif btnp(KEY_5) then elseif key.press(key.N5) then
current_camera=5 current_camera=5
end 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 end
end end
function redraw_menu_hab() function redraw_menu_hab()
draw_hab(menu_room,16,41) draw_hab(menu_room,16,41)
rectfill(0,0,14,96,16) draw.rectf(0,0,15*o2aX,97*o2aX,16)
rectfill(114,0,191,96,16) draw.rectf(114*o2aX,0,78*o2aX,97*o2aX,16)
rect(15,40,113,89,2) draw.rect(15*o2aX,40*o2aX,99*o2aX,50*o2aX,2)
mapa_update(abad.hab,menu_room) mapa_update(abad.hab,menu_room)
for key,actor in pairs(actors) do for key,actor in pairs(actors) do
@@ -350,166 +340,261 @@ end
function update_menu() function update_menu()
menu_change_room=menu_change_room-1 menu_change_room=menu_change_room-1
if menu_change_room==0 then if menu_change_room==0 then
menu_room = rnd(60) menu_room = math.random(0,59)
menu_change_room=300 menu_change_room=300
end end
cls(16) surf.cls(16)
text("C A C A U S", 42, 8, 15) -- text("C A C A U S", 42*o2aX, 8*o2aX, 15)
-- arc_textB("C A C A U S", 42*o2aX, 8*o2aX, 15)
draw_logo(14*o2aX, 0)
menu_state()
end
if menu_state == 0 then function update_options_menu()
menu_count=menu_count+1 menu_count=menu_count+1
local parpadeig=false local parpadeig=false
if menu_count>=20 then if menu_count>=20 then
parpadeig=true parpadeig=true
if menu_count>40 then menu_count=0 end if menu_count>40 then menu_count=0 end
end end
if (not parpadeig or menu_sel~=0) then text("JUGAR", 54, 16, 13) end draw.rect(28*o2aX,(28+(10*menu_sel))*o2aX,73*o2aX,9*o2aX,14)
if (not parpadeig or menu_sel~=1) then text("REDEFINIR TECLAT", 32, 24, 13) end if (not parpadeig) then draw.rect(28*o2aX,(28+(10*menu_sel))*o2aX,73*o2aX,9*o2aX,13) end
if (not parpadeig or menu_sel~=2) then text("REDEFINIR GAMEPAD", 30, 32, 13) end
-- draw.text("MÚSICA", 30*o2aX, 30*o2aX, 14); draw.text(music.enabled() and "SI" or "NO",91*o2aX,30*o2aX,15)
-- draw.text("SÓ", 30*o2aX, 40*o2aX, 14); draw.text(sound.enabled() and "SI" or "NO",91*o2aX,40*o2aX,15)
-- draw.text("REDEFINIR TECLAT", 30*o2aX, 50*o2aX, 14)
-- draw.text("REDEFINIR GAMEPAD", 30*o2aX, 60*o2aX, 14)
-- draw.text("TORNAR", 30*o2aX, 70*o2aX, 14)
arc_text("MÚSICA", 30*o2aX, 30*o2aX, 14); arc_text(music.enabled() and "SI" or "NO",91*o2aX,30*o2aX,15)
arc_text("", 30*o2aX, 40*o2aX, 14); arc_text(sound.enabled() and "SI" or "NO",91*o2aX,40*o2aX,15)
arc_text("REDEFINIR TECLAT", 30*o2aX, 50*o2aX, 14)
arc_text("REDEFINIR GAMEPAD", 30*o2aX, 60*o2aX, 14)
arc_text("TORNAR", 30*o2aX, 70*o2aX, 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*o2aX,(18+(10*menu_sel))*o2aX,73*o2aX,9*o2aX,14)
if (not parpadeig) then draw.rect(28*o2aX,(18+(10*menu_sel))*o2aX,73*o2aX,9*o2aX,13) end
-- text("JUGAR", 54*o2aX, 20*o2aX, 14)
arc_text("JUGAR", 54*o2aX, 20*o2aX, 14)
-- text("OPCIONS", 50*o2aX, 30*o2aX, 14)
arc_text("OPCIONS", 50*o2aX, 30*o2aX, 14)
--if (not parpadeig or menu_sel~=2) then text("REDEFINIR GAMEPAD", 30, 32, 13) end
redraw_menu_hab() redraw_menu_hab()
if btnp(keyShoot) or btnp(KEY_SPACE) or padp(BTN_A) or padp(btnShoot) then if key.press(keyShoot) or key.press(key.SPACE) or pad.press(pad.A) or pad.press(btnShoot) then
if menu_sel==0 then if menu_sel==0 then
game_exit() game_exit()
game_init() game_init()
fade.fadeoutin() fade.fadeoutin()
elseif menu_sel==1 then elseif menu_sel==1 then
menu_count=0 menu_count=0
menu_state=1 menu_sel=0
menu_state=update_options_menu--update_redefine_keys_menu;
else else
menu_count=0 menu_count=0
menu_state=2 menu_state=update_redefine_pad_menu
end end
elseif btnp(keyDown) or btnp(KEY_DOWN) or padp(BTN_DOWN) or padp(btnDown) then elseif key.press(keyDown) or key.press(key.DOWN) or pad.press(pad.DOWN) or pad.press(btnDown) then
menu_sel=menu_sel+1 menu_sel=menu_sel+1
if menu_sel==3 then menu_sel=0 end if menu_sel==2 then menu_sel=0 end
elseif btnp(keyUp) or btnp(KEY_UP) or padp(BTN_UP) or padp(btnUp) then elseif key.press(keyUp) or key.press(key.UP) or pad.press(pad.UP) or pad.press(btnUp) then
menu_sel=menu_sel-1 menu_sel=menu_sel-1
if menu_sel==-1 then menu_sel=2 end if menu_sel==-1 then menu_sel=1 end
elseif btnp(KEY_M) then elseif key.press(key.ESCAPE) or pad.press(btnPause) then
mute = not mute sys.quit()
if mute then
stopmusic()
else
playmus(audio_main_song)
end end
elseif btnp(KEY_ESCAPE) then
quit()
end end
elseif menu_state==1 then
if btnp(KEY_ESCAPE) then function update_redefine_keys_menu()
if key.press(key.ESCAPE) then
menu_count = 0 menu_count = 0
menu_state = 0 menu_state = update_options_menu;
end end
if menu_count==0 then if menu_count==0 then
text("PULSA TECLA PER A AMUNT", 20, 24, 13) -- text("PULSA TECLA PER A AMUNT", 20, 24, 13)
local key = btnp(); arc_textB("PULSA TECLA PER A AMUNT", 20*o2aX, 24*o2aX, 13)
if key ~= 0 and key~=KEY_ESCAPE then local k = key.press();
if k ~= 0 and k~=key.ESCAPE then
menu_count = 1 menu_count = 1
keyUp=key keyUp=k
setconf("keyup", keyUp) config.key("keyup", keyUp)
end end
elseif menu_count==1 then elseif menu_count==1 then
text("PULSA TECLA PER A AVALL", 20, 24, 13) -- text("PULSA TECLA PER A AVALL", 20, 24, 13)
local key = btnp(); arc_textB("PULSA TECLA PER A AVALL", 20*o2aX, 24*o2aX, 13)
if key ~= 0 and key~=KEY_ESCAPE then local k = key.press();
if k ~= 0 and k~=key.ESCAPE then
menu_count = 2 menu_count = 2
keyDown=key keyDown=k
setconf("keydown", keyDown) config.key("keydown", keyDown)
end end
elseif menu_count==2 then elseif menu_count==2 then
text("PULSA TECLA PER A ESQUERRA", 14, 24, 13) -- text("PULSA TECLA PER A ESQUERRA", 14, 24, 13)
local key = btnp(); arc_textB("PULSA TECLA PER A ESQUERRA", 14*o2aX, 24*o2aX, 13)
if key ~= 0 and key~=KEY_ESCAPE then local k = key.press();
if k ~= 0 and k~=key.ESCAPE then
menu_count = 3 menu_count = 3
keyLeft=key keyLeft=k
setconf("keleft", keyLeft) config.key("keleft", keyLeft)
end end
elseif menu_count==3 then elseif menu_count==3 then
text("PULSA TECLA PER A DRETA", 20, 24, 13) -- text("PULSA TECLA PER A DRETA", 20, 24, 13)
local key = btnp(); arc_textB("PULSA TECLA PER A DRETA", 20*o2aX, 24*o2aX, 13)
if key ~= 0 and key~=KEY_ESCAPE then local k = key.press();
if k ~= 0 and k~=key.ESCAPE then
menu_count = 4 menu_count = 4
keyRight=key keyRight=k
setconf("keyright", keyRight) config.key("keyright", keyRight)
end end
elseif menu_count==4 then elseif menu_count==4 then
text("PULSA TECLA PER A BOTAR", 20, 24, 13) -- text("PULSA TECLA PER A BOTAR", 20, 24, 13)
local key = btnp(); arc_textB("PULSA TECLA PER A BOTAR", 20*o2aX, 24*o2aX, 13)
if key ~= 0 and key~=KEY_ESCAPE then local k = key.press();
if k ~= 0 and k~=key.ESCAPE then
menu_count = 5 menu_count = 5
keyJump=key keyJump=k
setconf("keyjump", keyJump) config.key("keyjump", keyJump)
end end
elseif menu_count==5 then elseif menu_count==5 then
text("PULSA TECLA PER A DISPAR", 18, 24, 13) -- text("PULSA TECLA PER A DISPAR", 18, 24, 13)
local key = btnp(); arc_textB("PULSA TECLA PER A DISPAR", 18*o2aX, 24*o2aX, 13)
if key ~= 0 and key~=KEY_ESCAPE then local k = key.press();
if k ~= 0 and k~=key.ESCAPE then
menu_count = 0 menu_count = 0
menu_state = 0 menu_state = update_options_menu;
keyShoot=key keyShoot=k
setconf("keyshoot", keyShoot) config.key("keyshoot", keyShoot)
end
end
else
if btnp(KEY_ESCAPE) then
menu_count = 0
menu_state = 0
end
if menu_count==0 then
text("PULSA BOTÓ PER A AMUNT", 22, 24, 13)
local btn = padp();
if btn ~= -1 then
menu_count = 1
btnUp=btn
setconf("btnup", btnUp)
end
elseif menu_count==1 then
text("PULSA BOTÓ PER A AVALL", 22, 24, 13)
local btn = padp();
if btn ~= -1 then
menu_count = 2
btnDown=btn
setconf("btndown", btnDown)
end
elseif menu_count==2 then
text("PULSA BOTÓ PER A ESQUERRA", 16, 24, 13)
local btn = padp();
if btn ~= -1 then
menu_count = 3
btnLeft=btn
setconf("keleft", btnLeft)
end
elseif menu_count==3 then
text("PULSA BOTÓ PER A DRETA", 22, 24, 13)
local btn = padp();
if btn ~= -1 then
menu_count = 4
btnRight=btn
setconf("btnright", btnRight)
end
elseif menu_count==4 then
text("PULSA BOTÓ PER A BOTAR", 22, 24, 13)
local btn = padp();
if btn ~= -1 then
menu_count = 5
btnJump=btn
setconf("btnjump", btnJump)
end
elseif menu_count==5 then
text("PULSA BOTÓ PER A DISPAR", 20, 24, 13)
local btn = padp();
if btn ~= -1 then
menu_count = 0
menu_state = 0
btnShoot=btn
setconf("btnshoot", btnShoot)
end end
end end
end 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)
arc_textB("PULSA BOTÓ PER A AMUNT", 22*o2aX, 24*o2aX, 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)
arc_textB("PULSA BOTÓ PER A AVALL", 22*o2aX, 24*o2aX, 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)
arc_textB("PULSA BOTÓ PER A ESQUERRA", 16*o2aX, 24*o2aX, 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)
arc_textB("PULSA BOTÓ PER A DRETA", 22*o2aX, 24*o2aX, 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)
arc_textB("PULSA BOTÓ PER A BOTAR", 22*o2aX, 24*o2aX, 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)
arc_textB("PULSA BOTÓ PER A DISPAR", 20*o2aX, 24*o2aX, 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)
arc_textB("PULSA BOTÓ PER A GPS ARRERE", 14*o2aX, 24*o2aX, 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)
arc_textB("PULSA BOTÓ PER A GPS AVANT", 14*o2aX, 24*o2aX, 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)
arc_textB("PULSA BOTÓ PER A PAUSA", 22*o2aX, 24*o2aX, 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 end
function game_exit() function game_exit()
@@ -523,29 +608,80 @@ function aabb(a, b)
end end
function pause() function pause()
setsource(0) surf.source(0)
setdest(back) surf.target(back)
sspr(0,0,128,96,0,0) draw.surf(0,0,128*o2aX,96*o2aX,0,0)
setdest(0) surf.target(0)
setsource(tiles) surf.source(tiles)
pausa_option=1
pause_old_update=game_update pause_old_update=game_update
game_update=update_pause game_update=update_pause
end end
function update_pause() function update_pause()
rectfill(16,16,112,80,16) draw.rectf(16*o2aX,16*o2aX,97*o2aX,65*o2aX,16)
rect(16,16,112,80,15) draw.rect(16*o2aX,16*o2aX,97*o2aX,65*o2aX,15)
prnt("PAUSA",54,30,15) -- draw.text("PAUSA",54*o2aX,20*o2aX,15)
prnt("ESC torna al joc",30,50,14) arc_text("PAUSA",54*o2aX,20*o2aX,15)
prnt("SPACE eixir",30,60,14)
if btnp(KEY_ESCAPE) then menu_count=menu_count+1
setsource(back) local parpadeig=false
sspr(0,0,128,96,0,0) if menu_count>=20 then
setsource(tiles) parpadeig=true
if menu_count>40 then menu_count=0 end
end
draw.rect(28*o2aX,(33+(10*(pausa_option-1)))*o2aX,73*o2aX,9*o2aX,14)
if (not parpadeig) then draw.rect(28*o2aX,(33+(10*(pausa_option-1)))*o2aX,73*o2aX,9*o2aX,13) end
--draw.rect(28,33+(10*(pausa_option-1)),73,9,13)
-- draw.text("CONTINUAR",30*o2aX,35*o2aX,14)
arc_text("CONTINUAR",30*o2aX,35*o2aX,14)
-- draw.text("MUSICA:",30*o2aX,45*o2aX,14)
arc_text("MUSICA:",30*o2aX,45*o2aX,14)
if music.enabled() then
-- draw.text("SI",91*o2aX,45*o2aX,15)
arc_text("SI",91*o2aX,45*o2aX,15)
else
-- draw.text("NO",91*o2aX,45*o2aX,15)
arc_text("NO",91*o2aX,45*o2aX,15)
end
-- draw.text("SÓ:",30*o2aX,55*o2aX,14)
arc_text("SÓ:",30*o2aX,55*o2aX,14)
if sound.enabled() then
-- draw.text("SI",91*o2aX,55*o2aX,15)
arc_text("SI",91*o2aX,55*o2aX,15)
else
-- draw.text("NO",91*o2aX,55*o2aX,15)
arc_text("NO",91*o2aX,55*o2aX,15)
end
-- draw.text("EIXIR",30*o2aX,65*o2aX,14)
arc_text("EIXIR",30*o2aX,65*o2aX,14)
if key.press(key.ESCAPE) then
surf.source(back)
draw.surf(0,0,128*o2aX,96*o2aX,0,0)
surf.source(tiles)
game_update = pause_old_update game_update = pause_old_update
elseif btnp(keyShoot) or padp(btnShoot) then 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*o2aX,96*o2aX,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_exit()
game_init(true) game_init(true)
end end
end end
end

View File

@@ -1,8 +1,18 @@
local arcade_config = require("arcade_config")
o2aX = arcade_config.org2arc_escala
cxr = arcade_config.character_per_row-1
cxr2 = arcade_config.character_per_row_base2
cw = arcade_config.character_width
ch = arcade_config.character_height
-- posició en el gif
gorro_gif_col = 6
gorro_gif_row = 2
gorro={hab=5,x=48,y=24,bb={x=0,y=0,w=8,h=8}} gorro={hab=5,x=48,y=24,bb={x=0,y=0,w=8,h=8}}
function gorro.init() function gorro.init()
local habs={{60,5},{4,5},{34,4},{62,7},{75,4}} 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.hab=habs[r][1]
gorro.x=habs[r][2]*8 gorro.x=habs[r][2]*8
gorro.update=gorro.update gorro.update=gorro.update
@@ -10,7 +20,10 @@ function gorro.init()
end end
function gorro.draw() 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)
local x = gorro_gif_col*cw
local y = gorro_gif_row*ch
draw.surf(x,y,cw,ch,gorro.x*o2aX,gorro.y*o2aX,cw,ch)
end end
function gorro.update() function gorro.update()

View File

@@ -1,3 +1,13 @@
local arcade_config = require("arcade_config")
o2aX = arcade_config.org2arc_escala
cxr = arcade_config.character_per_row-1
cxr2 = arcade_config.character_per_row_base2
cw = arcade_config.character_width
ch = arcade_config.character_height
-- posició en el gif
gota_gif_col = 7
gota_gif_row = 0
gota={} gota={}
function gota.new(_hab,_x,_y,_freq) function gota.new(_hab,_x,_y,_freq)
@@ -5,7 +15,12 @@ function gota.new(_hab,_x,_y,_freq)
end end
function gota:draw_normal() function gota:draw_normal()
sspr(112,0,8,8,self.x,self.y) -- draw.surf(112,0,8,8,self.x,self.y)
local x = gota_gif_col*cw
local y = gota_gif_row*ch
local cw= 8*o2aX
local ch= 8*o2aX
draw.surf(x,y,cw,ch,self.x*o2aX,self.y*o2aX)
end end
function gota:update_normal() function gota:update_normal()
@@ -22,7 +37,7 @@ function gota:update_normal()
self.cx=self.x+2 self.cx=self.x+2
self.dx=0 self.dx=0
self.dy=-4 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 end
else else
--self.flip=not self.flip --self.flip=not self.flip
@@ -46,14 +61,14 @@ function gota:hit()
end end
function gota:draw_splash() function gota:draw_splash()
circfill(self.cx+self.dx,self.y,2,16) draw.circf( (self.cx+self.dx)*o2aX, self.y*o2aX, 2, 16)
circfill(self.cx+self.dx,self.y,1,11) draw.circf( (self.cx+self.dx)*o2aX, self.y*o2aX, 1, 11)
circfill(self.cx-self.dx,self.y,2,16) draw.circf( (self.cx-self.dx)*o2aX, self.y*o2aX, 2, 16)
circfill(self.cx-self.dx,self.y,1,11) draw.circf( (self.cx-self.dx)*o2aX, self.y*o2aX, 1, 11)
circfill(self.cx-(self.dx/2),self.y-4,2,16) draw.circf( (self.cx-(self.dx/2))*o2aX, (self.y-4)*o2aX, 2, 16)
circfill(self.cx-(self.dx/2),self.y-4,1,11) draw.circf( (self.cx-(self.dx/2))*o2aX, (self.y-4)*o2aX, 1, 11)
circfill(self.cx+(self.dx/2),self.y-4,2,16) draw.circf( (self.cx+(self.dx/2))*o2aX, (self.y-4)*o2aX, 2, 16)
circfill(self.cx+(self.dx/2),self.y-4,1,11) draw.circf( (self.cx+(self.dx/2))*o2aX, (self.y-4)*o2aX, 1, 11)
end end
function gota:update_splash() function gota:update_splash()

View File

@@ -1,8 +1,18 @@
local arcade_config = require("arcade_config")
o2aX = arcade_config.org2arc_escala
cxr = arcade_config.character_per_row-1
cxr2 = arcade_config.character_per_row_base2
cw = arcade_config.character_width
ch = arcade_config.character_height
-- posició en el gif
gps_gif_col = 7
gps_gif_row = 3
gps={hab=5,x=48,y=24,bb={x=0,y=0,w=8,h=8}} gps={hab=5,x=48,y=24,bb={x=0,y=0,w=8,h=8}}
function gps.init() function gps.init()
local habs={{33,8},{13,4},{51,9},{50,4},{42,7}} 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.hab=habs[r][1]
gps.x=habs[r][2]*8 gps.x=habs[r][2]*8
gps.update=gps.update gps.update=gps.update
@@ -10,7 +20,10 @@ function gps.init()
end end
function gps.draw() 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)
local x = gps_gif_col*cw
local y = gps_gif_row*ch
draw.surf(x,y,cw,ch,gps.x*o2aX,gps.y*o2aX,cw,ch)
end end
function gps.update() function gps.update()

View File

@@ -1,3 +1,10 @@
local arcade_config = require("arcade_config")
o2aX = arcade_config.org2arc_escala
cxr = arcade_config.character_per_row-1
cxr2 = arcade_config.character_per_row_base2
cw = arcade_config.character_width
ch = arcade_config.character_height
imp={hab=75,x=24,y=24,flip=true,enabled=false,counter=500,frame=28,wait=0,step=0,anim={28,29,28,30},bb={x=4,y=0,w=8,h=16},scene_intro=false,scene_object=false} imp={hab=75,x=24,y=24,flip=true,enabled=false,counter=500,frame=28,wait=0,step=0,anim={28,29,28,30},bb={x=4,y=0,w=8,h=16},scene_intro=false,scene_object=false}
function imp.reset() function imp.reset()
@@ -44,7 +51,8 @@ end
function imp.draw() function imp.draw()
if imp.enabled then 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)
draw.surf((imp.frame&7)*cw,(imp.frame>>cxr2)*ch,cw,ch,imp.x*o2aX,imp.y*o2aX,cw,ch,imp.flip)
end end
end end
@@ -58,7 +66,7 @@ function imp.update()
imp.wait=0 imp.wait=0
if not imp.enabled then if not imp.enabled then
imp.counter=imp.counter-1 imp.counter=imp.counter-1
local r = rnd(imp.counter) local r = math.random(0,imp.counter-1)
--print(r) --print(r)
if imp.counter==1 or r==1 then if imp.counter==1 or r==1 then
imp.init() imp.init()
@@ -73,7 +81,7 @@ function imp.update()
imp.x=imp.x-2 imp.x=imp.x-2
if imp.x==78 then if imp.x==78 then
fireball.init(imp.hab,imp.x+8,imp.y+4,imp.flip) fireball.init(imp.hab,imp.x+8,imp.y+4,imp.flip)
playsnd(audio_hit) sound.play(audio_hit)
imp.flip=not imp.flip imp.flip=not imp.flip
elseif imp.x==-12 then elseif imp.x==-12 then
imp.reset() imp.reset()
@@ -82,7 +90,7 @@ function imp.update()
imp.x=imp.x+2 imp.x=imp.x+2
if imp.x==4 then if imp.x==4 then
fireball.init(imp.hab,imp.x+8,imp.y+4,imp.flip) fireball.init(imp.hab,imp.x+8,imp.y+4,imp.flip)
playsnd(audio_hit) sound.play(audio_hit)
imp.flip=not imp.flip imp.flip=not imp.flip
elseif imp.x==92 then elseif imp.x==92 then
imp.reset() imp.reset()

View File

@@ -1,98 +1,132 @@
require "fade"
require "game"
require "mapa"
require "scenes"
local arcade_config = require("arcade_config")
intro_wait=40 intro_wait=40
intro_step=0 intro_step=0
o2aX = arcade_config.org2arc_escala
function intro_init() function intro_init()
game_update = intro_intro game_update = intro_intro
intro_wait=400 intro_wait=400
cls(16) surf.cls(16)
setdest(logo)
cls(16) surf.target(logo)
prnt("JAILGAMES",0,0,15) surf.cls(16)
setdest(0) draw.text("JAILGAMES",0,0,15)
setsource(logo) surf.target(0)
sspr(0,0,36,5,28,35,72,10) surf.source(logo)
setsource(tiles) draw.surf(0,0,36,5,56,70,arcade_config.logo_sf.width,arcade_config.logo_sf.height)
surf.target(logo)
surf.cls(16)
text("presenta",0,0,14)
surf.target(0)
surf.source(logo)
draw.surf(0,0,36,5,96,100,36*o2aX, 5*o2aX)
-- draw.surf(0,0,36,5,28,35,72,10)
-- draw.surf(0,0,36,5,56,70,arcade_config.logo_sf.width,arcade_config.logo_sf.height)
surf.source(tiles)
fade.fadein() fade.fadein()
end end
function intro_intro() function intro_intro()
--text("JAILGAMES",40,30,15) -- text("presenta",48,50,14)
text("presenta",48,50,14)
intro_wait=intro_wait-1 intro_wait=intro_wait-1
if intro_wait==0 or btnp(KEY_ESCAPE) or btnp(keyShoot) or padp(btnShoot) then 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 intro_wait=1
game_update = intro_update game_update = intro_update
fade.fadeoutin() fade.fadeoutin()
end end
if btnp(KEY_M) then
mute = not mute end
function draw_item_intro( name, flip )
local cw = arcade_config.character_width
local ch = arcade_config.character_height
if ( name == "abad" ) then
draw.surf(0,0,cw,ch,44*o2aX,24*o2aX,cw,ch,flip)
elseif (name == "batman" ) then
draw.surf(0,48*o2aX,cw,ch,82*o2aX,24*o2aX,cw,ch,flip)
elseif (name == "cacaus" ) then
draw.surf(112*o2aX,88*o2aX,cw,ch/2,76*o2aX,32*o2aX,cw,ch/2,flip)
elseif (name == "marc" ) then
draw.rect(15*o2aX,3*o2aX,99*o2aX,51*o2aX,2)
elseif (name == "pas porta" ) then
draw.rectf(73*o2aX,24*o2aX,7*o2aX,16*o2aX,16)
end end
end end
function draw_escenari ()
surf.cls(16)
draw_item_intro("marc",false)
view.origin(16*o2aX,4*o2aX)
mapa_draw(10)
-- Borrar la porta del mapa
draw_item_intro("pas porta")
end
function intro_update() function intro_update()
if btnp(KEY_ESCAPE) then if key.press(key.ESCAPE) or pad.press(btnPause) then
game_init(true) game_init(true)
fade.fadeoutin() fade.fadeoutin()
elseif btnp(KEY_SPACE) then elseif key.press(key.SPACE) then
intro_wait=1 intro_wait=1
elseif btnp(KEY_M) then
mute = not mute
end end
intro_wait=intro_wait-1 intro_wait=intro_wait-1
if intro_wait==0 then if intro_wait==0 then
-- STEP 0
if intro_step==0 then if intro_step==0 then
cls(16) draw_escenari()
rect(15,3,113,53,2) draw_item_intro("abad", true)
camera(-16,-4) view.origin(0,0)
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 intro_step=intro_step+1
-- STEP 1
elseif intro_step==1 then elseif intro_step==1 then
start_scene(scenes.intro_01,58) start_scene(scenes.intro_01,58)
intro_step=intro_step+1 intro_step=intro_step+1
-- STEP 2
elseif intro_step==2 then elseif intro_step==2 then
cls(16) draw_escenari()
rect(15,3,113,53,2) draw_item_intro("abad", false)
camera(-16,-4) view.origin(0,0)
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 intro_step=intro_step+1
-- STEP 3
elseif intro_step==3 then elseif intro_step==3 then
start_scene(scenes.intro_02,58) start_scene(scenes.intro_02,58)
intro_step=intro_step+1 intro_step=intro_step+1
-- STEP 4
elseif intro_step==4 then elseif intro_step==4 then
cls(16) draw_escenari()
rect(15,3,113,53,2) draw_item_intro("abad", false)
camera(-16,-4) draw_item_intro("cacaus", true)
mapa_draw(10) draw_item_intro("batman", true)
rectfill(73,24,79,39,16) view.origin(0,0)
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 intro_step=intro_step+1
-- STEP 5
elseif intro_step==5 then elseif intro_step==5 then
start_scene(scenes.intro_03,58) start_scene(scenes.intro_03,58)
intro_step=intro_step+1 intro_step=intro_step+1
-- STEP 6
elseif intro_step==6 then elseif intro_step==6 then
cls(16) draw_escenari()
rect(15,3,113,53,2) draw_item_intro("abad", false)
camera(-16,-4) view.origin(0,0)
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 intro_step=intro_step+1
-- STEP 7
elseif intro_step==7 then elseif intro_step==7 then
start_scene(scenes.intro_04,58) start_scene(scenes.intro_04,58)
intro_step=intro_step+1 intro_step=intro_step+1
-- STEP 8
elseif intro_step==8 then elseif intro_step==8 then
playmus(audio_main_song) music.play(audio_main_song)
game_init(true) game_init(true)
fade.fadeoutin() fade.fadeoutin()
end end

66
data/logo.lua Normal file
View File

@@ -0,0 +1,66 @@
local arcade_config = require("arcade_config")
o2aX = arcade_config.org2arc_escala
cxr = arcade_config.character_per_row-1
cxr2 = arcade_config.character_per_row_base2
cw = arcade_config.character_width
ch = arcade_config.character_height
toff = arcade_config.tiles_offset
tw = arcade_config.tiles_width
th = arcade_config.tiles_height
-- posició en el gif
C_gif_col = 10
C_gif_row = 3
A_gif_col = 11
A_gif_row = 3
U_gif_col = 12
U_gif_row = 3
S_gif_col = 15
S_gif_row = 4
X_gif_col = 11
X_gif_row = 7
DOS_gif_col = 12
DOS_gif_row = 7
function draw_logo (x, y)
local ox, oy = view.origin()
local curr_surf_tgt = surf.target()
local curr_surf_src = surf.source()
local sw = arcade_config.org_resolucion.width
local sh = arcade_config.org_resolucion.height
local dw = arcade_config.resolucion.width
local dh = arcade_config.resolucion.height
surf.target(x2logo)
view.origin(0,0)
surf.cls(0)
local C_x = C_gif_col*tw
local C_y = C_gif_row*th+toff
local A_x = A_gif_col*tw
local A_y = A_gif_row*th+toff
local U_x = U_gif_col*tw
local U_y = U_gif_row*th+toff
local S_x = S_gif_col*tw
local S_y = S_gif_row*th+toff
local X_x = X_gif_col*tw
local X_y = X_gif_row*th+toff
local DOS_x = DOS_gif_col*tw
local DOS_y = DOS_gif_row*th+toff
draw.surf(X_x,X_y,tw,th,0,0,tw,th)
draw.surf(DOS_x,DOS_y,tw,th,10,0,tw,th)
draw.surf(C_x,C_y,tw,th,24,0,tw,th)
draw.surf(A_x,A_y,tw,th,24+tw*1-4,0,tw,th)
draw.surf(C_x,C_y,tw,th,24+tw*2-7,0,tw,th)
draw.surf(A_x,A_y,tw,th,24+tw*3-11,0,tw,th)
draw.surf(U_x,U_y,tw,th,24+tw*4-14,0,tw,th)
draw.surf(S_x,S_y,tw,th,24+tw*5-15,0,tw,th)
surf.source(x2logo)
surf.target(curr_surf_tgt)
view.origin(ox,oy)
draw.surf(0,0,sw,sh,x,y,dw,dh)
surf.source(curr_surf_src)
end

View File

@@ -1,59 +1,174 @@
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"
function _init() local arcade_config = require("arcade_config")
tiles=loadsurf("tiles.gif")
setsource(tiles)
local pal=loadpal("tiles.gif")
setpal(pal)
logo=newsurf(36,5) --require "fade"
back=newsurf(128,96) --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(72,10)
logo=surf.new(arcade_config.logo_sf.width,arcade_config.logo_sf.height)
-- back=surf.new(128,96)
back=surf.new(arcade_config.surface.width,arcade_config.surface.height)
fade.init() fade.init()
audio_text_abad = loadsound(audio_text_abad) font_sf=font.load("X2_font.fnt")
audio_text_premiere = loadsound(audio_text_premiere)
audio_text_elalien = loadsound(audio_text_elalien) -- text_sf=surf.new(arcade_config.org_resolucion.width,arcade_config.org_resolucion.height)
audio_text_batman = loadsound(audio_text_batman) x2logo=surf.new(arcade_config.org_resolucion.width,arcade_config.org_resolucion.height)
audio_abad_jump = loadsound(audio_abad_jump)
audio_abad_fall = loadsound(audio_abad_fall) -- Càrrega dels audios
audio_abad_hit = loadsound(audio_abad_hit) audio_text_abad = sound.load(audio_text_abad)
audio_abad_shot = loadsound(audio_abad_shot) audio_text_premiere = sound.load(audio_text_premiere)
audio_abad_step[1] = loadsound(audio_abad_step[1]) audio_text_elalien = sound.load(audio_text_elalien)
audio_abad_step[2] = loadsound(audio_abad_step[2]) audio_text_batman = sound.load(audio_text_batman)
audio_abad_step[3] = loadsound(audio_abad_step[3]) 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_abad_step[4] = audio_abad_step[2]
audio_switch = loadsound(audio_switch) audio_switch = sound.load(audio_switch)
audio_hit = loadsound(audio_hit) audio_hit = sound.load(audio_hit)
audio_low = loadsound(audio_low) audio_low = sound.load(audio_low)
keyUp = tonumber(getconf("keyup")) or KEY_UP -- Configuració dels input
keyDown = tonumber(getconf("keydown")) or KEY_DOWN keyUp = tonumber(config.key("keyup")) or key.UP
keyLeft = tonumber(getconf("keyleft")) or KEY_LEFT keyDown = tonumber(config.key("keydown")) or key.DOWN
keyRight = tonumber(getconf("keyright")) or KEY_RIGHT keyLeft = tonumber(config.key("keyleft")) or key.LEFT
keyJump = tonumber(getconf("keyjump")) or KEY_UP keyRight = tonumber(config.key("keyright")) or key.RIGHT
keyShoot = tonumber(getconf("keyshoot")) or KEY_SPACE keyJump = tonumber(config.key("keyjump")) or key.UP
keyShoot = tonumber(config.key("keyshoot")) or key.SPACE
btnUp = tonumber(getconf("btnup")) or BTN_UP btnUp = tonumber(config.key("btnup")) or pad.UP
btnDown = tonumber(getconf("btndown")) or BTN_DOWN btnDown = tonumber(config.key("btndown")) or pad.DOWN
btnLeft = tonumber(getconf("btnleft")) or BTN_LEFT btnLeft = tonumber(config.key("btnleft")) or pad.LEFT
btnRight = tonumber(getconf("btnright")) or BTN_RIGHT btnRight = tonumber(config.key("btnright")) or pad.RIGHT
btnJump = tonumber(getconf("btnjump")) or BTN_UP btnJump = tonumber(config.key("btnjump")) or pad.B
btnShoot = tonumber(getconf("btnshoot")) or BTN_A 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() --game_init()
intro_init() intro_init()
-- final_init() -- final_init()
end end
function _update() function mini.update()
if btnp(KEY_F2) then if key.press(key.F1) then
local val = zoom() + 2 win.zoom(win.zoom()-1)
if val >= 10 then val = 2 end elseif key.press(key.F2) then
zoom(val) win.zoom(win.zoom()+1)
elseif btnp(KEY_F3) then elseif key.press(key.F3) then
local fs = fullscreen() local fs = win.fullscreen()
fullscreen(not fs) win.fullscreen(not fs)
cursor(fs) win.cursor(fs)
end end
if (game_update) then game_update() end if (game_update) then game_update() end
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
function arc_text(str, x, y, col)
-- local curr_surf_tgt = surf.target()
-- local curr_surf_src = surf.source()
-- local sw = arcade_config.org_resolucion.width
-- local sh = arcade_config.org_resolucion.height
-- local dw = arcade_config.resolucion.width
-- local dh = arcade_config.resolucion.height
-- surf.target(textsf)
-- surf.cls(0)
font.current(font_sf)
-- font.spacing(0)
draw.text(str,x,y,col)
-- draw.text(str,0,0,col)
-- print("arc_ "..str)
-- surf.source(textsf)
-- surf.target(curr_surf_tgt)
-- draw.surf(0,0,sw,sh,x,y,dw,dh)
-- surf.source(curr_surf_src)
end
function arc_textB(str, x, y, col)
-- local ox, oy = view.origin()
-- local curr_surf_tgt = surf.target()
-- local curr_surf_src = surf.source()
-- local sw = arcade_config.org_resolucion.width
-- local sh = arcade_config.org_resolucion.height
-- local dw = arcade_config.resolucion.width
-- local dh = arcade_config.resolucion.height
-- surf.target(textsf)
-- view.origin(0,0)
-- surf.cls(0)
font.current(font_sf)
-- font.spacing(0)
draw.text(str,x+0,y+0,16)
draw.text(str,x+1,y+0,16)
draw.text(str,x+2,y+0,16)
draw.text(str,x+0,y+1,16)
draw.text(str,x+2,y+1,16)
draw.text(str,x+0,y+2,16)
draw.text(str,x+1,y+2,16)
draw.text(str,x+2,y+2,16)
-- draw.text(str,1,1,col)
draw.text(str,x,y,col)
-- print("arc_B "..str)
-- surf.source(textsf)
-- surf.target(curr_surf_tgt)
-- view.origin(ox,oy)
-- draw.surf(0,0,dw,dw,x,y,dw,dh)
-- surf.source(curr_surf_src)
end

View File

@@ -1,4 +1,7 @@
--mapa={} require "map"
local arcade_config = require("arcade_config")
tiletype={void=0,nonpc=1,stair=2,switch=3,half=4,block=5} tiletype={void=0,nonpc=1,stair=2,switch=3,half=4,block=5}
mapa.wait=0 mapa.wait=0
mapa.step=0 mapa.step=0
@@ -47,7 +50,7 @@ function mapa_new()
end end
function mapa_save() function mapa_save()
file = io.open("data/map.lua", "w") local file = io.open("data/map.lua", "w")
io.output(file) io.output(file)
io.write("mapa={\n") io.write("mapa={\n")
for i=1,80 do for i=1,80 do
@@ -92,7 +95,13 @@ function mapa_draw(hab)
for tx=0,11 do for tx=0,11 do
local tile=mapa[1+hab][1+tx+ty*12] local tile=mapa[1+hab][1+tx+ty*12]
if tile~=256 and (tile<126 or mapa.step>4) then 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)
local txr = arcade_config.tiles_per_row-1
local txr2 = arcade_config.tiles_per_row_base2
local toff= arcade_config.tiles_offset
local tw = arcade_config.tiles_width
local th = arcade_config.tiles_height
draw.surf((tile&txr)*tw,toff+(tile>>txr2)*th,tw,th,tx*tw,ty*th)
end end
end end
end end
@@ -124,8 +133,8 @@ function mapa_cycle_colors(hab)
end end
function check_tile(hab,x,y) function check_tile(hab,x,y)
local xx=min(11,max(0,flr(x/8))) local xx=math.min(11,math.max(0,math.floor(x/8)))
local yy=min(5,max(0,flr(y/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) --rect(xx*8,yy*8,xx*8+8,yy*8+8,3)
local tile=mapa_get_tile(hab,xx,yy) local tile=mapa_get_tile(hab,xx,yy)
@@ -147,8 +156,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} 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() function mapa_create_minimap()
minimap = newsurf(128,96) minimap = surf.new(128,96)
setdest(minimap) surf.target(minimap)
for h=0,79 do for h=0,79 do
for y=0,5 do for y=0,5 do
for x=0,11 do for x=0,11 do
@@ -157,7 +166,7 @@ function mapa_create_minimap()
print(x..","..y.."="..tile) print(x..","..y.."="..tile)
end end
if tile<64 then 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
end end
@@ -167,8 +176,8 @@ end
function mapa_draw_minimap() function mapa_draw_minimap()
--print("HOLA") --print("HOLA")
setsource(minimap) surf.source(minimap)
setdest(0) surf.target(0)
cls(16) surf.cls(16)
sspr(0,0,128,96,0,0) draw.surf(0,0,128*o2aX,96*o2Ax,0,0)
end end

View File

@@ -1,8 +1,18 @@
local arcade_config = require("arcade_config")
o2aX = arcade_config.org2arc_escala
cxr = arcade_config.character_per_row-1
cxr2 = arcade_config.character_per_row_base2
cw = arcade_config.character_width
ch = arcade_config.character_height
-- posició en el gif
peu_gif_col = 7
peu_gif_row = 2
peu={hab=5,x=48,y=24,bb={x=0,y=0,w=8,h=8}} peu={hab=5,x=48,y=24,bb={x=0,y=0,w=8,h=8}}
function peu.init() 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 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.hab=habs[r][1]
peu.x=habs[r][2]*8 peu.x=habs[r][2]*8
peu.update=peu.update peu.update=peu.update
@@ -10,7 +20,10 @@ function peu.init()
end end
function peu.draw() 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)
local x = peu_gif_col*cw
local y = peu_gif_row*ch
draw.surf(x,y,cw,ch,peu.x*o2aX,peu.y*o2aX,cw,ch)
end end
function peu.update() function peu.update()

View File

@@ -1,3 +1,10 @@
local arcade_config = require("arcade_config")
o2aX = arcade_config.org2arc_escala
cxr = arcade_config.character_per_row-1
cxr2 = arcade_config.character_per_row_base2
cw = arcade_config.character_width
ch = arcade_config.character_height
premiere={hab=75,x=24,y=24,flip=true,frame=12,wait=0,step=0,anim={12,13,12,14},bb={x=4,y=0,w=8,h=16},scene_intro=false,scene_object=false} premiere={hab=75,x=24,y=24,flip=true,frame=12,wait=0,step=0,anim={12,13,12,14},bb={x=4,y=0,w=8,h=16},scene_intro=false,scene_object=false}
function premiere.init() function premiere.init()
@@ -10,11 +17,12 @@ function premiere.init()
premiere.scene_intro=false premiere.scene_intro=false
premiere.scene_object=false premiere.scene_object=false
local habs={75,44,20,0} local habs={75,44,20,0}
premiere.hab=habs[1+rnd(4)] premiere.hab=habs[1+math.random(0,3)]
end end
function premiere.draw() 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)
draw.surf((premiere.frame&7)*cw,(premiere.frame>>cxr2)*ch,cw,ch,premiere.x*o2aX,premiere.y*o2aX,cw,ch,premiere.flip)
end end
function premiere.hit() function premiere.hit()
@@ -145,8 +153,8 @@ function premiere.update_falling()
end end
end end
local xx=flr((premiere.x+4)/8) local xx=math.floor((premiere.x+4)/8)
local yy=flr((premiere.y+16)/8) local yy=math.floor((premiere.y+16)/8)
if premiere.y<32 then 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 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,127 +1,144 @@
require "final"
require "audio"
local arcade_config = require("arcade_config")
o2aX = arcade_config.org2arc_escala
avatar_abad_x = 3*o2aX
avatar_abad2_x = 4*o2aX
avatar_abad_y = 0
avatar_batman_x = 4*o2aX
avatar_batman_y = 48*o2aX
avatar_premiere_x = 69*o2aX
avatar_premiere_y = 20*o2aX
avatar_elalien_x = 3*o2aX
avatar_elalien_y = 16*o2aX
scenes={ scenes={
intro_01= { intro_01= {
{x=3,y=0,flip=false,audio="abad",text={"Ah!, què bo!","Nit de Netflix amb","un bon bol de cacaus!"},die=20}, {x=avatar_abad_x,y=avatar_abad_y,flip=false,audio="abad",text={"Ah!, què bo!","Nit de Netflix amb","un bon bol de cacaus!"},die=20},
}, },
intro_02= { intro_02= {
{x=3,y=0,flip=false,audio="abad",text={"Eh! On està el","bol de cacaus???",""},die=20}, {x=avatar_abad_x,y=avatar_abad_y,flip=false,audio="abad",text={"Eh! On està el","bol de cacaus???",""},die=20},
}, },
intro_03= { 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=avatar_batman_x,y=avatar_batman_y,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=avatar_abad_x,y=avatar_abad_y,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=avatar_batman_x,y=avatar_batman_y,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=avatar_batman_x,y=avatar_batman_y,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=avatar_abad_x,y=avatar_abad_y,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}, {x=avatar_batman_x,y=avatar_batman_y,flip=true,audio="batman",text={"Pos t'aguantes.","Ja pots despedir-te", "dels cacaus..."},die=20},
}, },
intro_04= { intro_04= {
{x=3,y=0,flip=false,audio="abad",text={"Serà mamó...","",""},die=20}, {x=avatar_abad_x,y=avatar_abad_y,flip=false,audio="abad",text={"Serà mamó...","",""},die=20},
}, },
abad_inici={ abad_inici={
{x=4,y=0,flip=false,audio="abad",text={"Se va a enterar eixe","imbècil de Batman","quan el pille..."}}, {x=avatar_abad2_x,y=avatar_abad_y,flip=false,audio="abad",text={"Se va a enterar eixe","imbècil de Batman","quan el pille..."}},
{x=4,y=0,flip=false,audio="abad",text={"Gonna per el GPS","per a trobarlo.",""}}, {x=avatar_abad2_x,y=avatar_abad_y,flip=false,audio="abad",text={"Gonna per el GPS","per a trobarlo.",""}},
{x=4,y=0,flip=false,audio="abad",text={"I igual hi ha","algú més per ací","que em puga ajudar."}}, {x=avatar_abad2_x,y=avatar_abad_y,flip=false,audio="abad",text={"I igual hi ha","algú més per ací","que em puga ajudar."}},
}, },
abad_corfes={ abad_corfes={
{x=4,y=0,flip=false,audio="abad",text={"Osti, està ple de","monstruacos.",""}}, {x=avatar_abad2_x,y=avatar_abad_y,flip=false,audio="abad",text={"Osti, està ple de","monstruacos.",""}},
{x=4,y=0,flip=false,audio="abad",text={"Pos al que s'acoste","s'endurà una corfa","de cacau al cap!"}}, {x=avatar_abad2_x,y=avatar_abad_y,flip=false,audio="abad",text={"Pos al que s'acoste","s'endurà una corfa","de cacau al cap!"}},
{x=4,y=0,flip=false,audio="abad",text={"I si van altets","igual val la pena","ajupir-se..."}} {x=avatar_abad2_x,y=avatar_abad_y,flip=false,audio="abad",text={"I si van altets","igual val la pena","ajupir-se..."}}
}, },
abad_portes={ abad_portes={
{x=4,y=0,flip=false,audio="abad",text={"Qui ha tancat totes","les portes?",""}}, {x=avatar_abad2_x,y=avatar_abad_y,flip=false,audio="abad",text={"Qui ha tancat totes","les portes?",""}},
{x=4,y=0,flip=false,audio="abad",text={"A saber on està","cada interruptor","per a obrir-les..."}}, {x=avatar_abad2_x,y=avatar_abad_y,flip=false,audio="abad",text={"A saber on està","cada interruptor","per a obrir-les..."}},
}, },
abad_porta_casa={ abad_porta_casa={
{x=4,y=0,flip=false,audio="abad",text={"Vaja, la porta de","casa també està","tancada."}}, {x=avatar_abad2_x,y=avatar_abad_y,flip=false,audio="abad",text={"Vaja, la porta de","casa també està","tancada."}},
{x=4,y=0,flip=false,audio="abad",text={"Però he de eixir!","Batman viu en la","casa de davant!"}}, {x=avatar_abad2_x,y=avatar_abad_y,flip=false,audio="abad",text={"Però he de eixir!","Batman viu en la","casa de davant!"}},
}, },
abad_porta_batman={ abad_porta_batman={
{x=4,y=0,flip=false,audio="abad",text={"Be, era de esperar","que Batman tinguera","la porta tancada."}}, {x=avatar_abad2_x,y=avatar_abad_y,flip=false,audio="abad",text={"Be, era de esperar","que Batman tinguera","la porta tancada."}},
{x=4,y=0,flip=false,audio="abad",text={"Crec que hi havia","un passadis secret","del meu sotan al seu."}}, {x=avatar_abad2_x,y=avatar_abad_y,flip=false,audio="abad",text={"Crec que hi havia","un passadis secret","del meu sotan al seu."}},
}, },
gps_trobat={ gps_trobat={
{x=4,y=0,flip=false,audio="abad",text={"Ale, ja tinc el GPS.","Ara puc trobar tot","el que necessite..."}}, {x=avatar_abad2_x,y=avatar_abad_y,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","de l'1 al 5",""}}, {x=avatar_abad2_x,y=avatar_abad_y,flip=false,audio="abad",text={"polsant les tecles","de l'1 al 5",""}},
}, },
premiere_intro={ premiere_intro={
{x=4,y=0,flip=false,audio="abad",musica=audio_song_premiere,text={"Premiere??","Qué fas per ma casa?",""}}, {x=avatar_abad2_x,y=avatar_abad_y,flip=false,audio="abad",musica=audio_song_premiere,text={"Premiere??","Qué fas per ma casa?",""}},
{x=69,y=20,flip=true,audio="premiere",text={"Porca miseria!!","l'uomo pipistrello!!","m'ha llevatto il gorro!"}}, {x=avatar_premiere_x,y=avatar_premiere_y,flip=true,audio="premiere",text={"Porca miseria!!","l'uomo pipistrello!!","m'ha llevatto il gorro!"}},
{x=4,y=0,flip=false,audio="abad",text={"Pipistrello??","Això ques??",""}}, {x=avatar_abad2_x,y=avatar_abad_y,flip=false,audio="abad",text={"Pipistrello??","Això ques??",""}},
{x=69,y=20,flip=true,audio="premiere",text={"Il batmano!!","Incontrame il gorro","per l'amore d'un porco!"}}, {x=avatar_premiere_x,y=avatar_premiere_y,flip=true,audio="premiere",text={"Il batmano!!","Incontrame il gorro","per l'amore d'un porco!"}},
{x=4,y=0,flip=false,audio="abad",text={"Tinc faena. A mi m'ha","furtat els cacaus i","he de trobarlos."}}, {x=avatar_abad2_x,y=avatar_abad_y,flip=false,audio="abad",text={"Tinc faena. A mi m'ha","furtat els cacaus i","he de trobarlos."}},
{x=69,y=20,flip=true,audio="premiere",text={"Lei tenne in su quarto!","Io tengo micha clave!","Achudame i t'achudo!"}} {x=avatar_premiere_x,y=avatar_premiere_y,flip=true,audio="premiere",text={"Lei tenne in su quarto!","Io tengo micha clave!","Achudame i t'achudo!"}}
}, },
premiere_intro_gorro={ premiere_intro_gorro={
{x=4,y=0,flip=false,audio="abad",musica=audio_song_premiere,text={"Premiere??","Qué fas per ma casa?",""}}, {x=avatar_abad2_x,y=avatar_abad_y,flip=false,audio="abad",musica=audio_song_premiere,text={"Premiere??","Qué fas per ma casa?",""}},
{x=69,y=20,flip=true,audio="premiere",text={"Porca miseria!!","l'uomo pipistrello!!","m'ha llevatto il gorro!"}}, {x=avatar_premiere_x,y=avatar_premiere_y,flip=true,audio="premiere",text={"Porca miseria!!","l'uomo pipistrello!!","m'ha llevatto il gorro!"}},
{x=4,y=0,flip=false,audio="abad",text={"Pipistrello??","Això... be, te igual","Ací el tens, atontat."}}, {x=avatar_abad2_x,y=avatar_abad_y,flip=false,audio="abad",text={"Pipistrello??","Això... be, te igual","Ací el tens, atontat."}},
{x=69,y=20,flip=true,audio="premiere",text={"Per fortuna!","Grazie mille!","Come podo achudarte?"}}, {x=avatar_premiere_x,y=avatar_premiere_y,flip=true,audio="premiere",text={"Per fortuna!","Grazie mille!","Come podo achudarte?"}},
{x=4,y=0,flip=false,audio="abad",text={"Pos Batman m'ha furtat","els cacaus. Supose que","els te amagats."}}, {x=avatar_abad2_x,y=avatar_abad_y,flip=false,audio="abad",text={"Pos Batman m'ha furtat","els cacaus. Supose que","els te amagats."}},
{x=69,y=20,flip=true,audio="premiere",text={"In lo suo quarto!","Io tengo micha clave!","Tenne, tenne!!"}} {x=avatar_premiere_x,y=avatar_premiere_y,flip=true,audio="premiere",text={"In lo suo quarto!","Io tengo micha clave!","Tenne, tenne!!"}}
}, },
premiere_gorro={ premiere_gorro={
{x=4,y=0,flip=false,audio="abad",musica=audio_song_premiere,text={"Tin, el ditxos gorro.","",""}}, {x=avatar_abad2_x,y=avatar_abad_y,flip=false,audio="abad",musica=audio_song_premiere,text={"Tin, el ditxos gorro.","",""}},
{x=69,y=20,flip=true,audio="premiere",text={"Bravissimo!","Che giornatta","fantastica! Figo!"}}, {x=avatar_premiere_x,y=avatar_premiere_y,flip=true,audio="premiere",text={"Bravissimo!","Che giornatta","fantastica! Figo!"}},
{x=4,y=0,flip=false,audio="abad",text={"Tu si que eres un","figo. On està eixa","mitja clau?"}}, {x=avatar_abad2_x,y=avatar_abad_y,flip=false,audio="abad",text={"Tu si que eres un","figo. On està eixa","mitja clau?"}},
{x=69,y=20,flip=true,audio="premiere",text={"Giusto! Aquí tenne!","Buona fortuna per","la tua avventura!"}}, {x=avatar_premiere_x,y=avatar_premiere_y,flip=true,audio="premiere",text={"Giusto! Aquí tenne!","Buona fortuna per","la tua avventura!"}},
{x=69,y=20,flip=true,audio="premiere",text={"E NON TOCARE il","Batmano! Sei molto","poderoso!"}} {x=avatar_premiere_x,y=avatar_premiere_y,flip=true,audio="premiere",text={"E NON TOCARE il","Batmano! Sei molto","poderoso!"}}
}, },
gorro_trobat_nointro={ gorro_trobat_nointro={
{x=4,y=0,flip=false,audio="abad",text={"Mira, el gorro","de Premiere.","Millor l'agafe."}} {x=avatar_abad2_x,y=avatar_abad_y,flip=false,audio="abad",text={"Mira, el gorro","de Premiere.","Millor l'agafe."}}
}, },
gorro_trobat={ gorro_trobat={
{x=4,y=0,flip=false,audio="abad",text={"Mira, el gorro","de Premiere.","A la saca."}} {x=avatar_abad2_x,y=avatar_abad_y,flip=false,audio="abad",text={"Mira, el gorro","de Premiere.","A la saca."}}
}, },
elalien_intro={ elalien_intro={
{x=4,y=0,flip=false,audio="abad",musica=audio_song_elalien,text={"Que passa alien?","A tu també t'ha","putejat el Batman?"}}, {x=avatar_abad2_x,y=avatar_abad_y,flip=false,audio="abad",musica=audio_song_elalien,text={"Que passa alien?","A tu també t'ha","putejat el Batman?"}},
{x=3,y=16,flip=true,audio="elalien",text={"CAGUEN L'OU!!","ESTAVA JO TAN TRANQUIL","PODANT AL MEU GOS..."}}, {x=avatar_elalien_x,y=avatar_elalien_y,flip=true,audio="elalien",text={"CAGUEN L'OU!!","ESTAVA JO TAN TRANQUIL","PODANT AL MEU GOS..."}},
{x=3,y=16,flip=true,audio="elalien",text={"...I QUAN NO MIRABA","M'HA FURTAT EL","MARANÀ!!!"}}, {x=avatar_elalien_x,y=avatar_elalien_y,flip=true,audio="elalien",text={"...I QUAN NO MIRABA","M'HA FURTAT EL","MARANÀ!!!"}},
{x=4,y=0,flip=false,audio="abad",text={"Es...taves podant","a un gos...?",""}}, {x=avatar_abad2_x,y=avatar_abad_y,flip=false,audio="abad",text={"Es...taves podant","a un gos...?",""}},
{x=3,y=16,flip=true,audio="elalien",text={"EN JUPITER NO POTS","DEIXAR QUE LI CREIXEN","MES DE 12 PATES!!"}}, {x=avatar_elalien_x,y=avatar_elalien_y,flip=true,audio="elalien",text={"EN JUPITER NO POTS","DEIXAR QUE LI CREIXEN","MES DE 12 PATES!!"}},
{x=4,y=0,flip=false,audio="abad",text={"Uh... clar...","A mi m'ha furtat","els cacaus."}}, {x=avatar_abad2_x,y=avatar_abad_y,flip=false,audio="abad",text={"Uh... clar...","A mi m'ha furtat","els cacaus."}},
{x=3,y=16,flip=true,audio="elalien",text={"ELS TÉ EN LA SEUA","HABITACIÓ SEGUR.","TROBA EL BERENAR..."}}, {x=avatar_elalien_x,y=avatar_elalien_y,flip=true,audio="elalien",text={"ELS TÉ EN LA SEUA","HABITACIÓ SEGUR.","TROBA EL BERENAR..."}},
{x=3,y=16,flip=true,audio="elalien",text={"...I JO ET DONARÉ","LA MEITAT DE LA CLAU","PER A ENTRAR."}} {x=avatar_elalien_x,y=avatar_elalien_y,flip=true,audio="elalien",text={"...I JO ET DONARÉ","LA MEITAT DE LA CLAU","PER A ENTRAR."}}
}, },
elalien_intro_peu={ elalien_intro_peu={
{x=4,y=0,flip=false,audio="abad",musica=audio_song_elalien,text={"Que passa alien?","A tu també t'ha","putejat el Batman?"}}, {x=avatar_abad2_x,y=avatar_abad_y,flip=false,audio="abad",musica=audio_song_elalien,text={"Que passa alien?","A tu també t'ha","putejat el Batman?"}},
{x=3,y=16,flip=true,audio="elalien",text={"CAGUEN L'OU!!","ESTAVA JO TAN TRANQUIL","PODANT AL MEU GOS..."}}, {x=avatar_elalien_x,y=avatar_elalien_y,flip=true,audio="elalien",text={"CAGUEN L'OU!!","ESTAVA JO TAN TRANQUIL","PODANT AL MEU GOS..."}},
{x=3,y=16,flip=true,audio="elalien",text={"...I QUAN NO MIRABA","M'HA FURTAT EL","MARANÀ!!!"}}, {x=avatar_elalien_x,y=avatar_elalien_y,flip=true,audio="elalien",text={"...I QUAN NO MIRABA","M'HA FURTAT EL","MARANÀ!!!"}},
{x=4,y=0,flip=false,audio="abad",text={"Podant...? be, te","igual. Açò deu ser","el teu berenar."}}, {x=avatar_abad2_x,y=avatar_abad_y,flip=false,audio="abad",text={"Podant...? be, te","igual. Açò deu ser","el teu berenar."}},
{x=3,y=16,flip=true,audio="elalien",text={"OSTI QUE BÓ!!!","GRACIES AUELO!","A TU QUE T'HA FET?"}}, {x=avatar_elalien_x,y=avatar_elalien_y,flip=true,audio="elalien",text={"OSTI QUE BÓ!!!","GRACIES AUELO!","A TU QUE T'HA FET?"}},
{x=4,y=0,flip=false,audio="abad",text={"M'ha furtat els cacaus.","Segur que els té","al seu quarto."}}, {x=avatar_abad2_x,y=avatar_abad_y,flip=false,audio="abad",text={"M'ha furtat els cacaus.","Segur que els té","al seu quarto."}},
{x=3,y=16,flip=true,audio="elalien",text={"SEGUR! PERO JO TINC","LA MEITAT DE LA CLAU.","TIN, I SORT!"}} {x=avatar_elalien_x,y=avatar_elalien_y,flip=true,audio="elalien",text={"SEGUR! PERO JO TINC","LA MEITAT DE LA CLAU.","TIN, I SORT!"}}
}, },
elalien_peu={ elalien_peu={
{x=4,y=0,flip=false,audio="abad",musica=audio_song_elalien,text={"Ací tens...","Uff, que peste fa...",""}}, {x=avatar_abad2_x,y=avatar_abad_y,flip=false,audio="abad",musica=audio_song_elalien,text={"Ací tens...","Uff, que peste fa...",""}},
{x=3,y=16,flip=true,audio="elalien",text={"GRACIES!!!","SÍ, EH? QUE","SUCOSET I BÓ."}}, {x=avatar_elalien_x,y=avatar_elalien_y,flip=true,audio="elalien",text={"GRACIES!!!","SÍ, EH? QUE","SUCOSET I BÓ."}},
{x=4,y=0,flip=false,audio="abad",text={"Clar...","Be, i eixa","mitja clau?"}}, {x=avatar_abad2_x,y=avatar_abad_y,flip=false,audio="abad",text={"Clar...","Be, i eixa","mitja clau?"}},
{x=3,y=16,flip=true,audio="elalien",text={"TIN! QUAN TINGUES","ELS CACAUS, PEGA-LI","CACAUÀ A BATMAN!"}}, {x=avatar_elalien_x,y=avatar_elalien_y,flip=true,audio="elalien",text={"TIN! QUAN TINGUES","ELS CACAUS, PEGA-LI","CACAUÀ A BATMAN!"}},
}, },
peu_trobat_nointro={ peu_trobat_nointro={
{x=4,y=0,flip=false,audio="abad",text={"Un peu podrit??","Qué asco!! Segur","que és d'el alien."}} {x=avatar_abad2_x,y=avatar_abad_y,flip=false,audio="abad",text={"Un peu podrit??","Qué asco!! Segur","que és d'el alien."}}
}, },
peu_trobat={ peu_trobat={
{x=4,y=0,flip=false,audio="abad",text={"Joer, açò deu ser","el berenar d'el alien.","Ecs..."}} {x=avatar_abad2_x,y=avatar_abad_y,flip=false,audio="abad",text={"Joer, açò deu ser","el berenar d'el alien.","Ecs..."}}
}, },
habitacio_batman={ habitacio_batman={
{x=4,y=0,flip=false,audio="abad",text={"L'habitació de Batman!","Segur que els cacaus","estàn ahí dins."}}, {x=avatar_abad2_x,y=avatar_abad_y,flip=false,audio="abad",text={"L'habitació de Batman!","Segur que els cacaus","estàn ahí dins."}},
{x=4,y=0,flip=false,audio="abad",text={"Però necessite","una clau...",""}} {x=avatar_abad2_x,y=avatar_abad_y,flip=false,audio="abad",text={"Però necessite","una clau...",""}}
}, },
bol_trobat={ bol_trobat={
{x=4,y=0,flip=false,audio="abad",text={"PER FI, JA TINC","ELS MEUS CACAUS!!!","OLE!! OLE!!"}}, {x=avatar_abad2_x,y=avatar_abad_y,flip=false,audio="abad",text={"PER FI, JA TINC","ELS MEUS CACAUS!!!","OLE!! OLE!!"}},
{x=4,y=0,flip=false,audio="abad",text={"Se va a enterar","Batman ara quan","el pille..."}}, {x=avatar_abad2_x,y=avatar_abad_y,flip=false,audio="abad",text={"Se va a enterar","Batman ara quan","el pille..."}},
{x=4,y=0,flip=false,audio="abad",text={"Ara si que li puc","pegar una bona","cacauà..."}} {x=avatar_abad2_x,y=avatar_abad_y,flip=false,audio="abad",text={"Ara si que li puc","pegar una bona","cacauà..."}}
}, },
final= { final= {
{x=4,y=48,flip=true,audio="batman",musica=audio_song_batman,text={"AI!", "M'has fet mal!!!",""},die=20}, {x=avatar_batman_x,y=avatar_batman_y,flip=true,audio="batman",musica=audio_song_batman,text={"AI!", "M'has fet mal!!!",""},die=20},
{x=3,y=0,flip=false,audio="abad",text={"Aixó per furtar-me","el bol de cacaus,","imbèsil"},die=20}, {x=avatar_abad_x,y=avatar_abad_y,flip=false,audio="abad",text={"Aixó per furtar-me","el bol de cacaus,","imbèsil"},die=20},
{x=4,y=48,flip=true,audio="batman",text={"Cert, esta me la","mereixia... però", "mira que be estàs!"},die=20}, {x=avatar_batman_x,y=avatar_batman_y,flip=true,audio="batman",text={"Cert, esta me la","mereixia... però", "mira que be estàs!"},die=20},
{x=4,y=48,flip=true,audio="batman",text={"Amb el que t'ha","costat pillar-me", "t'has ficat en forma"},die=20}, {x=avatar_batman_x,y=avatar_batman_y,flip=true,audio="batman",text={"Amb el que t'ha","costat pillar-me", "t'has ficat en forma"},die=20},
{x=3,y=0,flip=false,audio="abad",text={"No me vingues en","tonteries,","mamarratxo."},die=20}, {x=avatar_abad_x,y=avatar_abad_y,flip=false,audio="abad",text={"No me vingues en","tonteries,","mamarratxo."},die=20},
{x=3,y=0,flip=false,audio="abad",text={"Creus que no he","notat que falta mig","bol de cacaus?"},die=20}, {x=avatar_abad_x,y=avatar_abad_y,flip=false,audio="abad",text={"Creus que no he","notat que falta mig","bol de cacaus?"},die=20},
{x=4,y=48,flip=true,audio="batman",text={"Jejejeje, es que","estàn molt bons!", ""},die=20}, {x=avatar_batman_x,y=avatar_batman_y,flip=true,audio="batman",text={"Jejejeje, es que","estàn molt bons!", ""},die=20},
{x=4,y=48,flip=true,audio="batman",text={"Però si vols te","done del meu bol", "de tramussos."},die=20}, {x=avatar_batman_x,y=avatar_batman_y,flip=true,audio="batman",text={"Però si vols te","done del meu bol", "de tramussos."},die=20},
{x=3,y=0,flip=false,audio="abad",text={"TRAMUSSOS...","",""},die=10}, {x=avatar_abad_x,y=avatar_abad_y,flip=false,audio="abad",text={"TRAMUSSOS...","",""},die=10},
{x=3,y=0,flip=false,audio="abad",text={"M'atreviré a","passar l'última","frontera...?"},die=40}, {x=avatar_abad_x,y=avatar_abad_y,flip=false,audio="abad",text={"M'atreviré a","passar l'última","frontera...?"},die=40},
}, },
} }
@@ -129,7 +146,7 @@ function start_scene(scene,offset)
--bkg=newsurf(128,96) --bkg=newsurf(128,96)
--setdest(bkg) --setdest(bkg)
--setsource(0) --setsource(0)
--sspr(0,0,128,96,0,0) --draw.surf(0,0,128,96,0,0)
--setsource(tiles) --setsource(tiles)
--setdest(0) --setdest(0)
scenes.current_scene=scene scenes.current_scene=scene
@@ -141,7 +158,7 @@ function start_scene(scene,offset)
scenes.die=scenes.current_scene[scenes.dnum].die or 0 scenes.die=scenes.current_scene[scenes.dnum].die or 0
if scene[1].musica then if scene[1].musica then
--print(scene[1].musica) --print(scene[1].musica)
playmus(scenes.current_scene[scenes.dnum].musica) music.play(scenes.current_scene[scenes.dnum].musica)
end end
if offset then scenes.offset=offset end if offset then scenes.offset=offset end
old_update=game_update old_update=game_update
@@ -150,50 +167,74 @@ end
function playtext(snd) function playtext(snd)
if snd=="abad" then if snd=="abad" then
playsnd(audio_text_abad) sound.play(audio_text_abad)
elseif snd=="batman" then elseif snd=="batman" then
playsnd(audio_text_batman) sound.play(audio_text_batman)
elseif snd=="premiere" then elseif snd=="premiere" then
playsnd(audio_text_premiere) sound.play(audio_text_premiere)
elseif snd=="elalien" then elseif snd=="elalien" then
playsnd(audio_text_elalien) sound.play(audio_text_elalien)
end end
end end
function draw_photo ( photo_x, photo_y, flip, step )
local photo_w = 11*o2aX
local photo_h = 10*o2aX
local bkg_x = 8*o2aX
local bkg_y = 12*o2aX
local bkg_w = photo_w*2+2
local bkg_h = photo_h*2+2
local bkg_color = 16
if flip then
bkg_x = 96*o2aX+1
end
if step==3 then
bkg_y = 12*o2aX
bkg_h = 12*o2aX
elseif step==4 or step==8 then
bkg_y = 7*o2aX
bkg_h = photo_h*2+2
end
local photo_dx = bkg_x+1
local photo_dy = bkg_y+1
local photo_dw = bkg_w-2
local photo_dh = bkg_h-2
draw.rectf(bkg_x,bkg_y,bkg_w,bkg_h,bkg_color)
draw.surf(photo_x,photo_y,photo_w,photo_h,photo_dx,photo_dy,photo_dw,photo_dh, flip)
end
function draw_scene() function draw_scene()
local txt_x = not scenes.current_scene[scenes.dnum].flip and 38 or 8 local txt_x = not scenes.current_scene[scenes.dnum].flip and 38 or 8
camera(0,-scenes.offset)
view.origin(0,scenes.offset*o2aX)
if scenes.step==0 then if scenes.step==0 then
rectfill(0,16,128,17,12) draw.rectf(0,16*o2aX,129*o2aX,2*o2aX,12)
line(0,15,128,15,16) draw.line(0,15*o2aX,128*o2aX,15*o2aX,16)
line(0,18,128,18,16) draw.line(0,18*o2aX,128*o2aX,18*o2aX,16)
elseif scenes.step==1 then elseif scenes.step==1 then
rectfill(0,8,128,26,12) draw.rectf(0,8*o2aX,129*o2aX,19*o2aX,12)
line(0,7,128,7,16) draw.line(0,7*o2aX,128*o2aX,7*o2aX,16)
line(0,27,128,27,16) draw.line(0,27*o2aX,128*o2aX,27*o2aX,16)
elseif scenes.step==2 then elseif scenes.step==2 then
rectfill(0,0,128,34,12) draw.rectf(0,0,129*o2aX,35*o2aX,12)
line(0,0,128,0,16) draw.line(0,0,128*o2aX,0,16)
line(0,34,128,34,16) draw.line(0,34*o2aX+1,128*o2aX,34*o2aX+1,16)
elseif scenes.step==3 then elseif scenes.step==3 then
if not scenes.current_scene[scenes.dnum].flip then draw_photo ( scenes.current_scene[scenes.dnum].x, scenes.current_scene[scenes.dnum].y, scenes.current_scene[scenes.dnum].flip, scenes.step)
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)
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)
end
elseif scenes.step==4 then elseif scenes.step==4 then
if not scenes.current_scene[scenes.dnum].flip then draw_photo ( scenes.current_scene[scenes.dnum].x, scenes.current_scene[scenes.dnum].y, scenes.current_scene[scenes.dnum].flip, scenes.step)
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)
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)
end
elseif scenes.step==5 then elseif scenes.step==5 then
text(string.sub(scenes.current_scene[scenes.dnum].text[1],1,scenes.char),txt_x,7,2) -- text(string.sub(scenes.current_scene[scenes.dnum].text[1],1,scenes.char),txt_x*o2aX,7*o2aX,2)
if scenes.char<#scenes.current_scene[scenes.dnum].text[1] then -- view.origin(0,scenes.offset-20) -- Ni idea de perquè 38, o es 19*o2aX?
-- arc_textB(string.sub(scenes.current_scene[scenes.dnum].text[1],1,scenes.char),txt_x*o2aX,7*o2aX,2)
arc_textB(utf8.sub(scenes.current_scene[scenes.dnum].text[1],1,scenes.char),txt_x*o2aX,7*o2aX,2)
-- if scenes.char<#scenes.current_scene[scenes.dnum].text[1] then
if scenes.char<utf8.len(scenes.current_scene[scenes.dnum].text[1]) then
scenes.step=scenes.step-1 scenes.step=scenes.step-1
scenes.char=scenes.char+1 scenes.char=scenes.char+1
playtext(scenes.current_scene[scenes.dnum].audio) playtext(scenes.current_scene[scenes.dnum].audio)
@@ -201,8 +242,12 @@ function draw_scene()
scenes.char=1 scenes.char=1
end end
elseif scenes.step==6 then elseif scenes.step==6 then
text(string.sub(scenes.current_scene[scenes.dnum].text[2],1,scenes.char),txt_x,15,2) -- text(string.sub(scenes.current_scene[scenes.dnum].text[2],1,scenes.char),txt_x*o2aX,15*o2aX,2)
if scenes.char<#scenes.current_scene[scenes.dnum].text[2] then -- view.origin(0,scenes.offset-20) -- Ni idea de perquè 38, o es 19*o2aX?
-- arc_textB(string.sub(scenes.current_scene[scenes.dnum].text[2],1,scenes.char),txt_x*o2aX,15*o2aX,2)
arc_textB(utf8.sub(scenes.current_scene[scenes.dnum].text[2],1,scenes.char),txt_x*o2aX,15*o2aX,2)
-- if scenes.char<#scenes.current_scene[scenes.dnum].text[2] then
if scenes.char<utf8.len(scenes.current_scene[scenes.dnum].text[2]) then
scenes.step=scenes.step-1 scenes.step=scenes.step-1
scenes.char=scenes.char+1 scenes.char=scenes.char+1
playtext(scenes.current_scene[scenes.dnum].audio) playtext(scenes.current_scene[scenes.dnum].audio)
@@ -210,8 +255,12 @@ function draw_scene()
scenes.char=1 scenes.char=1
end end
elseif scenes.step==7 then elseif scenes.step==7 then
text(string.sub(scenes.current_scene[scenes.dnum].text[3],1,scenes.char),txt_x,23,2) -- text(string.sub(scenes.current_scene[scenes.dnum].text[3],1,scenes.char),txt_x*o2aX,23*o2aX,2)
if scenes.char<#scenes.current_scene[scenes.dnum].text[3] then -- view.origin(0,scenes.offset-20) -- Ni idea de perquè 38, o es 19*o2aX?
-- arc_textB(string.sub(scenes.current_scene[scenes.dnum].text[3],1,scenes.char),txt_x*o2aX,23*o2aX,2)
arc_textB(utf8.sub(scenes.current_scene[scenes.dnum].text[3],1,scenes.char),txt_x*o2aX,23*o2aX,2)
-- if scenes.char<#scenes.current_scene[scenes.dnum].text[3] then
if scenes.char<utf8.len(scenes.current_scene[scenes.dnum].text[3]) then
scenes.step=scenes.step-1 scenes.step=scenes.step-1
scenes.char=scenes.char+1 scenes.char=scenes.char+1
playtext(scenes.current_scene[scenes.dnum].audio) playtext(scenes.current_scene[scenes.dnum].audio)
@@ -219,22 +268,26 @@ function draw_scene()
scenes.char=1 scenes.char=1
end end
elseif scenes.step==8 then elseif scenes.step==8 then
rectfill(0,0,128,34,12) draw.rectf(0,0,129*o2aX,35*o2aX,12)
line(0,0,128,0,16) draw.line(0,0,128*o2aX,0,16)
line(0,34,128,34,16) draw.line(0,34*o2aX+1,128*o2aX,34*o2aX+1,16)
if not scenes.current_scene[scenes.dnum].flip then draw_photo ( scenes.current_scene[scenes.dnum].x, scenes.current_scene[scenes.dnum].y, scenes.current_scene[scenes.dnum].flip, scenes.step)
rectfill(8,7,31,28,16) -- if not scenes.current_scene[scenes.dnum].flip then
sspr(scenes.current_scene[scenes.dnum].x,scenes.current_scene[scenes.dnum].y,10,10,9,8,20,20) -- draw.rectf(8*o2aX,7*o2aX,24*o2aX,22*o2aX,16)
else -- draw.surf(scenes.current_scene[scenes.dnum].x,scenes.current_scene[scenes.dnum].y,avatar_w,avatar_h,9*o2aX,8*o2aX,20*o2aX,20*o2aX)
rectfill(97,7,120,28,16) -- else
sspr(scenes.current_scene[scenes.dnum].x,scenes.current_scene[scenes.dnum].y,10,10,98,8,20,20,true) -- draw.rectf(97*o2aX,7*o2aX,24*o2aX,22*o2aX,16)
end -- draw.surf(scenes.current_scene[scenes.dnum].x,scenes.current_scene[scenes.dnum].y,avatar_w,avatar_h,98*o2aX,8*o2aX,20*o2aX,20*o2aX,true)
text(scenes.current_scene[scenes.dnum].text[1],txt_x,7,2) -- end
text(scenes.current_scene[scenes.dnum].text[2],txt_x,15,2) -- text(scenes.current_scene[scenes.dnum].text[1],txt_x*o2aX,7*o2aX,2)
text(scenes.current_scene[scenes.dnum].text[3],txt_x,23,2) -- text(scenes.current_scene[scenes.dnum].text[2],txt_x*o2aX,15*o2aX,2)
-- text(scenes.current_scene[scenes.dnum].text[3],txt_x*o2aX,23*o2aX,2)
arc_textB(scenes.current_scene[scenes.dnum].text[1],txt_x*o2aX,7*o2aX,2)
arc_textB(scenes.current_scene[scenes.dnum].text[2],txt_x*o2aX,15*o2aX,2)
arc_textB(scenes.current_scene[scenes.dnum].text[3],txt_x*o2aX,23*o2aX,2)
end end
if scenes.step<=8 then scenes.step=scenes.step+1 end if scenes.step<=8 then scenes.step=scenes.step+1 end
camera(0,0) view.origin(0,0)
end end
function update_scene() function update_scene()
@@ -249,7 +302,7 @@ function update_scene()
scenes.die=scenes.die-1 scenes.die=scenes.die-1
if scenes.die==0 then if scenes.die==0 then
if scenes.dnum==#scenes.current_scene then if scenes.dnum==#scenes.current_scene then
stopmusic() music.stop()
if batman.endgame then if batman.endgame then
final_init() final_init()
fade.fadeoutin() fade.fadeoutin()
@@ -263,30 +316,28 @@ function update_scene()
end end
end end
else else
if flr(time()*2)%2==0 then if math.floor(sys.time()*2)%2==0 then
sspr(104,88,7,5,118,56) draw.surf(104*o2aX,88*o2aX,7*o2aX,5*o2aX,118*o2aX,56*o2aX)
else else
rectfill(118,56,125,61,12) draw.rectf(118*o2aX,56*o2aX,8*o2aX,6*o2aX,12)
end end
end end
end end
end end
if btnp(KEY_ESCAPE) and (scenes.current_scene~=scenes.final) 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 if scenes.current_scene[scenes.dnum].die then
game_init(true) game_init(true)
else else
pause() pause()
end end
elseif btnp(KEY_M) then
mute = not mute
end end
if scenes.step>8 then 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 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
padp(btnShoot) or padp(btnDown) or padp(btnUp) or padp(btnLeft) or padp(btnRight) then 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 if scenes.dnum==#scenes.current_scene then
stopmusic() music.stop()
if batman.endgame then if batman.endgame then
final_init() final_init()
fade.fadeoutin() fade.fadeoutin()
@@ -298,7 +349,7 @@ function update_scene()
scenes.step=2 scenes.step=2
end end
end end
elseif btnp(keyShoot) or padp(btnShoot) then elseif key.press(keyShoot) or pad.press(btnShoot) then
scenes.step=8 scenes.step=8
end end
end end

View File

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

View File

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

@@ -71,8 +71,8 @@ end
function triggers:teleport_a() function triggers:teleport_a()
abad.teleport=true abad.teleport=true
playsnd(audio_hit) sound.play(audio_hit)
cls(14) surf.cls(14)
imp.reset() imp.reset()
abad.hab=67 abad.hab=67
abad.x=24 abad.x=24
@@ -80,8 +80,8 @@ end
function triggers:teleport_b() function triggers:teleport_b()
if abad.teleport then if abad.teleport then
playsnd(audio_hit) sound.play(audio_hit)
cls(14) surf.cls(14)
imp.reset() imp.reset()
abad.hab=14 abad.hab=14
abad.x=16 abad.x=16
@@ -90,8 +90,8 @@ end
function triggers:teleport_c() function triggers:teleport_c()
abad.teleport2=true abad.teleport2=true
playsnd(audio_hit) sound.play(audio_hit)
cls(14) surf.cls(14)
imp.reset() imp.reset()
abad.hab=61 abad.hab=61
abad.x=24 abad.x=24
@@ -99,8 +99,8 @@ end
function triggers:teleport_d() function triggers:teleport_d()
if abad.teleport2 then if abad.teleport2 then
playsnd(audio_hit) sound.play(audio_hit)
cls(14) surf.cls(14)
imp.reset() imp.reset()
abad.hab=29 abad.hab=29
abad.x=24 abad.x=24

View File

@@ -1,3 +1,10 @@
local arcade_config = require("arcade_config")
o2aX = arcade_config.org2arc_escala
cxr = arcade_config.character_per_row-1
cxr2 = arcade_config.character_per_row_base2
cw = arcade_config.character_width
ch = arcade_config.character_height
zombie={} zombie={}
function zombie.new(_hab,_x,_y,_flip) function zombie.new(_hab,_x,_y,_flip)
@@ -5,7 +12,8 @@ function zombie.new(_hab,_x,_y,_flip)
end end
function zombie:draw() 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
if self.frame>0 then draw.surf((self.frame&7)*cw,(self.frame>>cxr2)*ch,cw,ch,self.x*o2aX,self.y*o2aX,cw,ch,self.flip) end
end end
function zombie:update_normal() function zombie:update_normal()

7
readme.md Normal file
View File

@@ -0,0 +1,7 @@
# X2 Cacaus
<h3 align="center">Cacaus amb resolució X2!</h3>
Fet amb mini 1.4.4 (https://gitea.sustancia.synology.me/JailDoctor/mini)
<p>Projecte original [JailDoctor/cacaus] (https://gitea.sustancia.synology.me/JailDoctor/cacaus)