Compare commits

...

9 Commits

Author SHA1 Message Date
JailGamer faac5dc947 [WIP] Stage 2. Tiles per als núvols 2026-05-31 17:53:35 +02:00
JailGamer 9d044d10f9 [CHG] Ajustos en el copter per a dur conductor 2026-05-31 13:46:56 +02:00
JailGamer ef87fd3c25 [WIP] Reestructurant codi
[WIP] Stage 2 ja 'arranca'
2026-05-30 22:20:24 +02:00
JailGamer 714ed083d4 [NEW] Incrementat requeriment de mini a 1.5.11 2026-05-30 13:34:57 +02:00
JailGamer e0825e5bbb [WIP] Reestructurant codi abans de posar-me en el nivell 2
[NEW] Afegit music_player
[NEW] Música de fons des de l'inici
2026-05-29 23:28:51 +02:00
JailGamer 2eb4bc82eb [WIP] Stage 2 2026-05-25 22:08:22 +02:00
JailGamer a29dea89ae Reestructuració i neteja de codi 2026-05-24 23:09:43 +02:00
JailGamer 43013f9c4b [NEW] 1up 2026-05-24 19:46:49 +02:00
JailGamer 1456f3addc [FIX] Expresió mal posicionada 2026-05-24 19:11:30 +02:00
31 changed files with 934 additions and 1550 deletions
+32 -28
View File
@@ -64,9 +64,11 @@ function abad_init()
bb={x=8,y=0,w=16,h=32}, bb={x=8,y=0,w=16,h=32},
safe={hab=10,x=40,y=24}, safe={hab=10,x=40,y=24},
move=abad.move, move=abad.move,
mood="normal"} mood="normal",
vehicle=""}
abad.update=abad_state_normal abad.update=abad_state_normal
abad.objects={} abad.objects={}
-- abad.objects={clau_premiere = true, clau_elalien = true}
end end
function abad:move( x, y ) function abad:move( x, y )
@@ -102,36 +104,33 @@ end
function abad:draw() function abad:draw()
local flip = abad.flip local flip = abad.flip
local x, y = viewp:screen_coords(self.x, self.y) local x, y = viewp:screen_coords(self.x, self.y)
if abad.update==abad_state_stairs then if abad.vehicle=="" then
-- flip=abad.stairs_flip if abad.update==abad_state_stairs then
-- -- flip=(((abad.x>>1)+(abad.y>>1))%2)==0 if math.abs(abad.stairs_moves-(abad.x+abad.y))>12 then
if math.abs(abad.stairs_moves-(abad.x+abad.y))>12 then abad.stairs_moves = abad.x+abad.y
abad.stairs_moves = abad.x+abad.y abad.flip = not abad.flip
abad.flip = not abad.flip end
flip = abad.flip
end end
flip = abad.flip
-- if ((abad.x+abad.y)%12)==0 then
-- abad.stairs_flip=not abad.stairs_flip
-- end
-- local msg = "-- "..abad.x.." "..abad.y if (abad.respawning==0) or (math.floor(abad.respawning/15)%2==0) then
-- if flip then msg = "FLIP"..abad.x.." "..abad.y end draw.surf(abad.frame*abad.w,0,abad.w,abad.h,x,y,abad.w,abad.h,flip)
-- -- msg_print(0,35,msg,true) -- caminant, parat, disparant o saltant
end if abad.frame<=3 or abad.frame==6 then
abad_add_mood(x,0,y,0,flip,abad.mood)
if (abad.respawning==0) or (math.floor(abad.respawning/15)%2==0) then end
draw.surf(abad.frame*abad.w,0,abad.w,abad.h,x,y,abad.w,abad.h,flip)
-- caminant, parat, disparant o saltant
if abad.frame<=3 or abad.frame==6 then
abad_add_mood(x,0,y,0,flip,abad.mood)
end end
end
if abad.respawning > 0 then
abad.respawning=abad.respawning-1
end
-- draw.rect(x+abad.bb.x,y+abad.bb.y,abad.bb.w,abad.bb.h,3) if abad.respawning > 0 then
abad.respawning=abad.respawning-1
end
-- draw.rect(x+abad.bb.x,y+abad.bb.y,abad.bb.w,abad.bb.h,3)
elseif abad.vehicle=="copter" then
surf.source.push(tiles2)
draw.surf(96,0,abad.w,abad.h,x,y,abad.w,abad.h,flip)
surf.source.pop()
end
end end
function abad_make_safe( force ) function abad_make_safe( force )
@@ -144,6 +143,10 @@ function abad_make_safe( force )
end end
end end
function abad_lifes_up(howmuch)
abad.vides = abad.vides + howmuch
end
function abad_heal(howmuch) function abad_heal(howmuch)
abad.energia = abad.energia + howmuch abad.energia = abad.energia + howmuch
if abad.energia>abad.max_energia then if abad.energia>abad.max_energia then
@@ -165,7 +168,8 @@ function abad_hurt(howmuch)
-- dead.start() -- dead.start()
-- music.play(audio_game_over,0) -- music.play(audio_game_over,0)
else else
music.play(audio_life_lost,0) -- music.play(audio_life_lost,0)
music_player:play(audio_life_lost,0,true)
abad.energia=abad.max_energia abad.energia=abad.max_energia
-- abad.hab=abad.safe.hab -- abad.hab=abad.safe.hab
-- abad.x=abad.safe.x -- abad.x=abad.safe.x
+39 -19
View File
@@ -1,23 +1,43 @@
audio_main_song="mus_menu.ogg" audio_main_song ="mus_menu.ogg"
audio_song_batman="mus_batm.ogg" audio_song_batman ="mus_batm.ogg"
audio_song_premiere="mus_prem.ogg" audio_song_premiere="mus_prem.ogg"
audio_song_elalien="mus_alie.ogg" audio_song_elalien ="mus_alie.ogg"
audio_life_lost="mus_life.ogg" audio_life_lost ="mus_life.ogg"
audio_game_over="mus_over.ogg" audio_game_over ="mus_over.ogg"
audio_song_imp="mus_imp.ogg" audio_song_imp ="mus_imp.ogg"
audio_song_copter="mus_copter.ogg" audio_song_copter ="mus_copter.ogg"
audio_final=audio_main_song audio_final=audio_main_song
audio_abad_jump="snd_ajmp.wav" audio_abad_jump ="snd_ajmp.wav"
audio_abad_fall="snd_afal.wav" audio_abad_fall ="snd_afal.wav"
audio_abad_hit="snd_ahit.wav" audio_abad_hit ="snd_ahit.wav"
audio_abad_shot="snd_asht.wav" audio_abad_shot ="snd_asht.wav"
audio_abad_step={"snd_ast1.wav", "snd_ast2.wav", "snd_ast3.wav", "snd_ast2.wav"} audio_abad_step ={"snd_ast1.wav", "snd_ast2.wav", "snd_ast3.wav", "snd_ast2.wav"}
audio_switch="snd_swch.wav" audio_switch ="snd_swch.wav"
audio_hit="snd_hit.wav" audio_hit ="snd_hit.wav"
audio_low="snd_low.wav" audio_low ="snd_low.wav"
audio_text_abad="snd_txta.wav" audio_text_abad ="snd_txta.wav"
audio_text_premiere="snd_txtp.wav" audio_text_premiere="snd_txtp.wav"
audio_text_elalien="snd_txte.wav" audio_text_elalien ="snd_txte.wav"
audio_text_batman="snd_txtb.wav" audio_text_batman ="snd_txtb.wav"
audio_text_imp="snd_txtb.wav" audio_text_imp ="snd_txtb.wav"
function audio_init()
-- Càrrega dels audios
audio_text_abad = sound.load(audio_text_abad)
audio_text_premiere = sound.load(audio_text_premiere)
audio_text_elalien = sound.load(audio_text_elalien)
audio_text_batman = sound.load(audio_text_batman)
audio_text_imp = sound.load(audio_text_imp)
audio_abad_jump = sound.load(audio_abad_jump)
audio_abad_fall = sound.load(audio_abad_fall)
audio_abad_hit = sound.load(audio_abad_hit)
audio_abad_shot = sound.load(audio_abad_shot)
audio_abad_step[1] = sound.load(audio_abad_step[1])
audio_abad_step[2] = sound.load(audio_abad_step[2])
audio_abad_step[3] = sound.load(audio_abad_step[3])
audio_abad_step[4] = audio_abad_step[2]
audio_switch = sound.load(audio_switch)
audio_hit = sound.load(audio_hit)
audio_low = sound.load(audio_low)
end
+32 -10
View File
@@ -28,18 +28,33 @@ copter={
enabled=true, enabled=true,
disable_reason="", disable_reason="",
enabled=true, enabled=true,
rider = nil,
gir = {} gir = {}
} }
function copter.init() function copter.init(rider)
local world_x, world_y = coords.room_to_world(copter.hab,copter.x,copter.y) if rider==nil then
copter.x=world_x local world_x, world_y = coords.room_to_world(copter.hab,copter.x,copter.y)
copter.y=world_y copter.x=world_x
copter.y=world_y
else
copter.rider = rider
copter.hab = rider.hab
copter.x = rider.x-32
copter.y = rider.y-32
copter.y = copter.y-16
end
copter.gir[1] = math.random(8)-1
copter.gir[2] = math.random(4)-1
copter.gir[3] = math.random(8)-1
copter.gir[4] = math.random(6)-1
copter.gir[5] = math.random(8)-1
copter.gir[6] = math.random(4)-1
end end
function copter.draw() function copter.draw()
local curr_sf = surf.source() -- local curr_sf = surf.source()
surf.source(tiles2) surf.source.push(tiles2)
local scr_x, scr_y = viewp:screen_coords( copter.x, copter.y ) local scr_x, scr_y = viewp:screen_coords( copter.x, copter.y )
draw.surf(0,0,copter.w,copter.h,scr_x,scr_y,copter.w,copter.h,copter.flip) draw.surf(0,0,copter.w,copter.h,scr_x,scr_y,copter.w,copter.h,copter.flip)
if copter.wait==0 or copter.wait==32 then if copter.wait==0 or copter.wait==32 then
@@ -59,13 +74,20 @@ function copter.draw()
draw.line(scr_x+51,scr_y+23,scr_x+64+copter.gir[4],scr_y+38,16) draw.line(scr_x+51,scr_y+23,scr_x+64+copter.gir[4],scr_y+38,16)
draw.line(scr_x+47,scr_y+16,scr_x+43+copter.gir[5],scr_y+8,16) draw.line(scr_x+47,scr_y+16,scr_x+43+copter.gir[5],scr_y+8,16)
end end
surf.source(curr_sf) -- surf.source(curr_sf)
surf.source.pop()
end end
function copter.update() function copter.update()
copter.step = copter.step +1 copter.step = copter.step +1
copter.wait = copter.wait +1 copter.wait = copter.wait +1
if copter.wait==16 then if copter.wait==16 then
copter.wait = 0 copter.wait = 0
end end
if copter.rider~=nil then
copter.hab = copter.rider.hab
copter.x = copter.rider.x-32
copter.y = copter.rider.y-32
copter.y = copter.y-16
end
end end
+81 -90
View File
@@ -1,3 +1,32 @@
require "controller"
require "audio"
arcade_config = require("arcade_config")
require "states"
require "requirements"
require "logo"
require "intro"
require "title"
require "opcions"
require "opcions_input"
require "pause"
require "game_over"
require "scenes"
coords = require "coords"
require "helpers"
require "music_player"
-- require "map"
require "mapa"
require "warp"
require "fade"
require "point"
require "fps"
--require "menu"
viewport= require("viewport") viewport= require("viewport")
require "stage_mgr" require "stage_mgr"
require "abad" require "abad"
@@ -19,19 +48,22 @@ require "imp3"
require "fireball" require "fireball"
require "bar_meter" require "bar_meter"
require "stage1" -- require "stage1"
require "remote_view" require "remote_view"
require "dialeg" require "dialeg"
require "trigger_event" require "trigger_event"
require "batman" require "batman"
require "health_potion" require "health_potion"
require "one_up"
require "tiles_layer2" require "tiles_layer2"
require "batvio" require "batvio"
-- require "live_scene" -- require "live_scene"
require "copter" require "copter"
require "sign" require "sign"
font_default = font.current()
local tile_w = arcade_config.tiles_width local tile_w = arcade_config.tiles_width
local tile_h = arcade_config.tiles_height local tile_h = arcade_config.tiles_height
local res_w = arcade_config.resolucion.width local res_w = arcade_config.resolucion.width
@@ -43,89 +75,63 @@ local view_checking_tile = false
viewp = viewport.new(arcade_config.resolucion.width, arcade_config.resolucion.height) viewp = viewport.new(arcade_config.resolucion.width, arcade_config.resolucion.height)
viewp:position(0,0) viewp:position(0,0)
function foo() -- actors={}
print("foo")
function game_load()
surf.target(0)
surf.cls(16)
math.randomseed(os.time())
mapa_surface_init()
-- states:executar("check-reqs")
states:executar("title")
controller:init()
fonts_init()
images_init()
fade.init()
audio_init()
logo_config(font_sf)
end end
function actor_warp_draw(actor) function game_init(menu)
local shrink_w = actor.w*actor.shrink actors={}
local shrink_h = actor.h*actor.shrink abad_init()
local offset_x = math.floor((actor.w-shrink_w)/2) table.insert(actors,abad)
local offset_y = math.floor((actor.h-shrink_h)/2) score.create()
local scr_x, scr_y = viewp:screen_coords( actor.x+offset_x, actor.y+offset_y )
shrink_w = math.floor(shrink_w)
shrink_h = math.floor(shrink_h)
if shrink_w>0 and shrink_h>0 then stages.load_stage(true)
draw.surfrot((actor.frame&7)*cw, (actor.frame>>cxr2)*ch, states:next()
cw, ch,
scr_x, scr_y,
actor.angle,
shrink_w, shrink_h,
actor.flip)
end
end end
function actor_warp_update(actor)
-- warp, wait, respawn
if actor.warping then
if actor.step<actor.death_time then
actor.shrink=actor.shrink-actor.d_shrink
actor.angle=actor.angle+actor.d_angle
if actor.angle>=360 then actor.angle = actor.angle % 360 end
if actor.shrink<=0 then
actor.shrink=1
actor.d_shrink=1
actor.angle=0
actor.d_angle=1
actor.warping = false
actor.frame = -1
actor.step = 0
if actor.energy~=nil then
actor.energy = actor.max_energy
end
end
end
elseif actor.step<actor.death_time/2 then
actor.frame = -1
elseif actor.step<actor.death_time then
if actor.step%2==0 then
actor.frame=actor.anim[#actor.anim]
else
actor.frame=-1
end
elseif actor.step>=actor.death_time then
actor.frame=actor.anim[1]
actor.step=0
actor.wait=0
if actor.name=="caco" then
actor.update=caco.update_normal
elseif actor.name=="zombie" then
actor.update=zombie.update_normal
end
actor.dying = false
end
end
actors={}
function game_exit() function game_exit()
-- mapa_restore_backup() -- mapa_restore_backup()
actors={} actors={}
-- cameras={} -- cameras={}
end end
--
-- Carregar fonts general del joc
--
function fonts_init()
font_sf=font.load("X2_font.fnt")
end
function game_init(menu) function images_init()
-- print("GAME INIT") tiles=surf.load("tiles.gif")
actors={} surf.source(tiles)
local paleta=pal.load("tiles.gif")
abad_init() pal.set(paleta)
table.insert(actors,abad) tiles2=surf.load("tiles2.gif")
-- Crear el warp
score.create() warp.init(tiles)
end
stages.load_stage(true) -- function image_close()
states:next() -- surf.free(tiles)
-- warp.close()
-- end
function mapa_surface_init()
if (sf_mapa) then surf.free(sf_mapa) end
sf_mapa=surf.new(mapa_room_cols*mapa_rooms_per_piso,mapa_room_rows*mapa_pisos)
end end
function render_map( sf_map, sf_tiles, x, y, target ) function render_map( sf_map, sf_tiles, x, y, target )
@@ -139,23 +145,6 @@ function render_map( sf_map, sf_tiles, x, y, target )
view.origin(0,0) view.origin(0,0)
end end
function viewport_update()
-- Moure el viewport
local vp_x = viewp.x
local vp_y = viewp.y
local vp_center_offset_x = (viewp.width // 2)
local vp_center_offset_y = (viewp.height // 2)
vp_x = abad.x+(abad.w/2) - vp_center_offset_x
if vp_x < 0 then vp_x = 0 end
vp_y = abad.y - vp_center_offset_y
if vp_y < 0 then vp_y = 0 end
viewp:position(vp_x, vp_y)
end
function world_update() function world_update()
-- Actualitzar moviment del mapa (ex: tiles animats) -- Actualitzar moviment del mapa (ex: tiles animats)
arc_mapa_update() arc_mapa_update()
@@ -231,10 +220,12 @@ end
function update_game() function update_game()
surf.target(0) surf.target(0)
surf.cls(16) surf.cls(16)
music_player:update()
world_update() world_update()
viewport_update() stages.stage_viewport_update()
world_draw() world_draw()
+2 -1
View File
@@ -9,7 +9,8 @@ function game_over_init()
dead.vel[i]=(200+math.random(0,399))/400 dead.vel[i]=(200+math.random(0,399))/400
end end
-- game_update=dead.update -- game_update=dead.update
music.play(audio_game_over,0) -- music.play(audio_game_over,0)
music_player:play(audio_game_over,0)
states:next() states:next()
end end
+84 -50
View File
@@ -1,70 +1,75 @@
local abad={x=0,y=0,w=32,h=32,dx=88,dy=48,dw=32,dh=32}
local batman={x=0,y=96,w=32,h=32,dx=164,dy=48,dw=32,dh=32} local abad ={ x=0, y= 0, w=32, h=32, dx= 88, dy=48, dw=32, dh=32 }
local cacaus={x=224,y=176,w=32,h=16,dx=152,dy=64,dw=32,dh=16} local batman={ x=0, y= 96, w=32, h=32, dx=164, dy=48, dw=32, dh=32 }
local cacaus_trans={x=192,y=176,w=16,h=8,dx=65,dy=56,dw=16,dh=8} local cacaus={ x=224, y=176, w=32, h=16, dx=152, dy=64, dw=32, dh=16 }
local marc={x=30,y=6,w=198,h=102,color=2} local cacaus_trans={ x=192, y=176, w=16, h=8, dx=65, dy=56, dw=16, dh=8 }
local pas_porta={x=146,y=48,w=14,h=32,color=16} local marc={ x=30, y=6, w=198, h=102, color=2 }
local pas_porta={ x=146, y=48, w=14, h=32, color=16 }
local scene_x_offset = 32 local scene_x_offset = 32
local scene_y_offset = 8 local scene_y_offset = 8
intro_wait=40 local tiles_file = "tiles.gif"
intro_step=0 local next_state = "title"
function draw_escenari () local intro_wait=40
surf.cls(16) local intro_step=0
draw_item_intro("marc",false)
view.origin(scene_x_offset, scene_y_offset)
mapa_draw(10)
-- Borrar la porta del mapa
draw_item_intro("pas porta")
end
function draw_item_intro( name, flip, mood ) local intro_mapa_room_cols = 12; -- en quantitat de tiles
if ( name == "abad" ) then local intro_mapa_room_rows = 6; -- en quantitat de tiles
-- abad.mood = mood or "normal" local intro_mapa_rooms_per_piso = 1
draw.surf(abad.x, abad.y, abad.w, abad.h, abad.dx, abad.dy, abad.dw, abad.dh, flip) local intro_mapa_pisos = 1
abad_add_mood(abad.dx,0,abad.dy,0,flip,mood) local intro_mapa_empty_tile = 256
elseif (name == "batman" ) then
draw.surf(batman.x, batman.y, batman.w, batman.h, batman.dx, batman.dy, batman.dw, batman.dh, flip) local intro_mapa={
elseif (name == "cacaus" ) then -- 1
draw.surf(cacaus.x, cacaus.y, cacaus.w, cacaus.h, cacaus.dx, cacaus.dy, cacaus.dw, cacaus.dh, flip) {
elseif (name == "cacaus trans" ) then 256, 66, 26, 27, 28, 29, 28, 29, 26, 27, 28, 29,
draw.surf(cacaus_trans.x, cacaus_trans.y, cacaus_trans.w, cacaus_trans.h, cacaus_trans.dx, cacaus_trans.dy, cacaus_trans.dw, cacaus_trans.dh, flip) 256,256,256, 24,256,256,256,256,256, 25,256,256,
elseif (name == "marc" ) then 64, 68,256,256,256,256,256,256,256, 25,256,256,
draw.rect(marc.x, marc.y, marc.w, marc.h, marc.color) 256,256, 66, 24,256,121,256,256,256, 38,256,256,
elseif (name == "pas porta" ) then 256, 66,256, 24,101,102,103,256,256, 38,256,256,
draw.rectf(pas_porta.x, pas_porta.y, pas_porta.w, pas_porta.h, pas_porta.color) 66,256,256, 24, 28, 29, 28, 29, 28, 29, 28, 29,
end },
end }
function intro_init() function intro_init()
print("INTRO_INIT") -- print("INTRO_INIT")
-- game_update = intro_intro mapa = intro_mapa
intro_wait=400 mapa_room_cols = intro_mapa_room_cols
mapa_room_rows = intro_mapa_room_rows
mapa_rooms_per_piso = intro_mapa_rooms_per_piso
mapa_pisos = intro_mapa_pisos
mapa_empty_tile = intro_mapa_empty_tile
mapa_surface_init()
load_tilemap( sf_mapa )
tiles=surf.load(tiles_file)
surf.source(tiles) surf.source(tiles)
local paleta=pal.load(tiles_file)
pal.set(paleta)
intro_wait=400
surf.target(0) surf.target(0)
surf.cls(16) surf.cls(16)
fade.fadein() fade.fadein()
font.current(font_sf) font.current(font_sf)
-- flow:add_path({intro_intro, intro_update})
states:next() states:next()
end end
function intro_intro() function intro_intro()
-- print("INTRO_INTRO")
intro_wait=1 intro_wait=1
-- game_update = intro_update
states:next() states:next()
fade.fadeoutin() fade.fadeoutin()
end end
function intro_update() function intro_update()
-- print("INTRO_UPDATE")
if key.press(key.ESCAPE) or pad.press(btnPause) then if key.press(key.ESCAPE) or pad.press(btnPause) then
-- game_init(true) states:next()
print("INTRO_UPDATE")
-- game_update = menu_init
-- game_init(true)
intro_end()
elseif key.press(key.SPACE) then elseif key.press(key.SPACE) then
intro_wait=1 intro_wait=1
end end
@@ -121,21 +126,50 @@ function intro_update()
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 -- STEP 8
elseif intro_step==8 then elseif intro_step==8 then
-- game_init(true) states:next()
-- game_update = menu_init
intro_end()
end end
intro_wait=50 intro_wait=50
end end
end end
function intro_end() function intro_end()
print("intro_end") -- print("INTRO_END")
fade.fadeoutin() fade.fadeoutin()
states:executar("title") states:executar(next_state)
end end
states:registrar("intro", {intro_init, intro_intro, intro_update}) function draw_escenari ()
surf.cls(16)
draw_item_intro("marc",false)
view.origin(scene_x_offset, scene_y_offset)
mapa_draw(0)
-- Borrar la porta del mapa
draw_item_intro("pas porta")
end
function draw_item_intro( name, flip, mood )
if ( name == "abad" ) then
draw.surf(abad.x, abad.y, abad.w, abad.h, abad.dx, abad.dy, abad.dw, abad.dh, flip)
abad_add_mood(abad.dx,0,abad.dy,0,flip,mood)
elseif (name == "batman" ) then
draw.surf(batman.x, batman.y, batman.w, batman.h, batman.dx, batman.dy, batman.dw, batman.dh, flip)
elseif (name == "cacaus" ) then
draw.surf(cacaus.x, cacaus.y, cacaus.w, cacaus.h, cacaus.dx, cacaus.dy, cacaus.dw, cacaus.dh, flip)
elseif (name == "cacaus trans" ) then
draw.surf(cacaus_trans.x, cacaus_trans.y, cacaus_trans.w, cacaus_trans.h, cacaus_trans.dx, cacaus_trans.dy, cacaus_trans.dw, cacaus_trans.dh, flip)
elseif (name == "marc" ) then
draw.rect(marc.x, marc.y, marc.w, marc.h, marc.color)
elseif (name == "pas porta" ) then
draw.rectf(pas_porta.x, pas_porta.y, pas_porta.w, pas_porta.h, pas_porta.color)
end
end
states:registrar("intro", {intro_init, intro_intro, intro_update, intro_end})
+4 -92
View File
@@ -1,97 +1,7 @@
arcade_config = require("arcade_config")
coords = require "coords"
require "helpers"
require "controller"
require "states"
require "map"
require "mapa"
require "warp"
require "fade"
require "audio"
require "requirements"
require "logo"
require "intro"
require "scenes"
require "title"
require "game" require "game"
require "opcions"
require "opcions_input"
require "point"
require "pause"
require "game_over"
require "fps"
--require "menu"
coords.set_config({
tiles_width = arcade_config.tiles_width,
tiles_height = arcade_config.tiles_height,
room_cols = mapa_room_cols,
room_rows = mapa_room_rows,
rooms_per_floor = mapa_rooms_per_piso,
})
font_default = font.current()
function images_init()
tiles=surf.load("tiles.gif")
surf.source(tiles)
local paleta=pal.load("tiles.gif")
pal.set(paleta)
tiles2=surf.load("tiles2.gif")
-- Crear el warp
warp.init(tiles)
end
function image_close()
surf.free(tiles)
warp.close()
end
function fonts_init()
font_sf=font.load("X2_font.fnt")
end
function mapa_init()
sf_mapa=surf.new(mapa_room_cols*mapa_rooms_per_piso,mapa_room_rows*mapa_pisos)
load_tilemap( sf_mapa )
end
function audio_init()
-- Càrrega dels audios
audio_text_abad = sound.load(audio_text_abad)
audio_text_premiere = sound.load(audio_text_premiere)
audio_text_elalien = sound.load(audio_text_elalien)
audio_text_batman = sound.load(audio_text_batman)
audio_text_imp = sound.load(audio_text_imp)
audio_abad_jump = sound.load(audio_abad_jump)
audio_abad_fall = sound.load(audio_abad_fall)
audio_abad_hit = sound.load(audio_abad_hit)
audio_abad_shot = sound.load(audio_abad_shot)
audio_abad_step[1] = sound.load(audio_abad_step[1])
audio_abad_step[2] = sound.load(audio_abad_step[2])
audio_abad_step[3] = sound.load(audio_abad_step[3])
audio_abad_step[4] = audio_abad_step[2]
audio_switch = sound.load(audio_switch)
audio_hit = sound.load(audio_hit)
audio_low = sound.load(audio_low)
end
function mini.init() function mini.init()
-- back_sf=surf.new(256,192) game_load()
math.randomseed(os.time())
fonts_init()
images_init()
mapa_init()
fade.init()
audio_init()
controller:init()
logo_config(font_sf)
surf.target(0)
surf.cls(16)
states:executar("check-reqs")
end end
function mini.update() function mini.update()
@@ -105,7 +15,9 @@ function mini.update()
win.cursor(fs) win.cursor(fs)
end end
if (game_update) then game_update() end if (game_update) then
game_update()
end
-- Pausa per a que vaja be en mini 1.5.1 -- Pausa per a que vaja be en mini 1.5.1
-- local t0 = os.clock() -- local t0 = os.clock()
-839
View File
@@ -1,839 +0,0 @@
mapa_room_cols = 12; -- en quantitat de tiles
mapa_room_rows = 6; -- en quantitat de tiles
mapa_rooms_per_piso = 10
mapa_pisos = 8
mapa_empty_tile = 256
-- 0 1 2 3 4 5 6 7 8 9
-- 10 11 12 13 14 15 16 17 18 19
-- ...
-- 70 71 72 73 74 75 76 77 78 79
mapa={
-- 1
{
256,256,256,18,19,21,20,21,20,21,20,21,
64,68,256,16,72,256,256,256,256,256,256,256,
256,256,66,256,88,256,256,70,71,256,256,256,
256,66,256,16,256,112,256,86,87,256,114,256,
66,256,256,16,256,256,256,256,256,256,256,256,
256,64,256,16,20,21,20,21,20,21,20,21,
},
-- 2
{
20,21,20,21,20,21,20,21,20,21,20,21,
256,256,256,256,256,256,256,256,256,256,256,256,
256,256,73,74,256,256,256,256,73,74,256,256,
256,256,89,90,256,256,256,256,89,90,256,256,
256,256,256,256,256,256,256,256,256,256,256,256,
-- 20,21,20,21,20,21,21,256,80,17,20,21,
20,21,20,21,20,21,21,256,256,0,20,21,
},
-- 3
{
20,21,20,21,20,21,20,21,20,21,20,21,
256,256,256,256,256,256,256,256,256,256,256,256,
256,96,97,96,256,73,74,256,97,96,96,256,
256,99,256,100,256,89,90,256,99,256,100,256,
256,256,256,256,256,256,256,256,256,256,256,256,
20,21,20,21,20,21,20,21,20,21,20,21,
},
-- 4
{
20,21,20,21,20,21,20,21,20,21,18,19,
256,256,256,256,256,256,256,256,256,256,77,17,
256,73,74,256,256,73,74,256,98,98,93,17,
256,89,90,256,256,89,90,256,99,100,256,256,
256,256,256,256,256,256,256,256,10,11,256,256,
20,21,20,21,20,21,20,21,10,11,20,21,
},
-- 5
{
66,256,256,67,256,65,256,64,256,256,256,66,
256,256,64,256,256,256,256,256,256,68,256,67,
18,19,18,19,18,19,18,19,256,256,65,256,
256,256,256,256,256,256,256,16,256,256,256,256,
256,256,256,256,256,256,256,16,256,64,256,66,
20,21,20,21,20,21,20,21,256,256,66,256,
},
-- 6
{
256,66,256,41,44,45,44,45,44,45,44,45,
64,256,256,41,256,256,256,256,256,256,256,256,
68,256,66,256,256,256,96,97,256,256,256,256,
256,67,256,41,256,256,99,100,256,256,256,256,
65,256,256,41,95,256,256,256,10,11,256,256,
256,65,42,43,44,45,44,45,10,11,44,45,
},
-- 7
{
42,43,256,256,256,256,65,256,256,256,256,64,
256,41,256,67,256,256,256,256,68,256,256,256,
256,41,256,256,256,66,256,256,256,256,256,256,
256,256,256,64,256,256,65,256,67,256,67,256,
256,256,256,256,256,256,256,256,256,256,256,256,
42,43,20,21,20,21,20,21,20,21,20,21,
},
-- 8
{
67,256,256,256,256,65,256,256,256,256,64,256,
256,256,67,256,256,256,256,68,256,256,256,256,
256,256,256,256,66,256,256,256,256,256,256,67,
256,256,64,256,256,65,256,67,256,67,256,256,
256,256,256,256,256,111,111,256,256,256,256,256,
20,21,20,21,17,256,256,17,20,21,20,21,
},
-- 9
{
256,256,256,256,65,256,256,256,256,64,17,17,
256,67,256,256,256,256,68,256,256,256,17,256,
256,256,256,66,256,256,256,256,256,256,17,256,
256,64,256,256,65,256,67,256,67,256,256,256,
256,256,256,256,256,256,256,256,256,256,256,256,
20,21,20,21,20,21,20,21,20,21,20,21,
},
-- 10
{
17,17,17,17,17,17,17,17,17,17,18,19,
256,256,256,256,256,256,256,256,256,256,17,17,
256,256,73,74,256,256,73,74,256,256,18,19,
256,256,89,90,256,256,89,90,256,256,17,17,
256,256,256,256,256,256,256,256,256,256,18,19,
-- 20,21,256,80,17,18,19,17,18,19,17,17,
20,21,256,256,0,18,19,17,18,19,17,17,
},
-- 11
{
256,66,26,27,28,29,28,29,26,27,28,29,
256,256,256,24,256,256,256,256,15,25,256,256,
64,68,256,256,256,256,256,256,256,25,256,256,
256,256,66,24,256,121,256,256,256,38,256,256,
256,66,256,24,101,102,103,256,256,38,256,256,
66,256,256,24,28,29,28,29,28,29,28,29,
},
-- 12
{
-- 28,29,28,29,28,29,29,256,256,256,26,27,
28,29,28,29,28,29,29,1,256,256,26,27,
256,256,256,256,256,256,256,256,256,25,72,256,
256,256,73,74,256,256,256,256,1,256,88,256,
256,256,89,90,256,256,256,1,256,256,256,256,
256,256,256,256,256,256,1,256,256,256,256,256,
28,29,28,29,28,29,28,29,28,29,28,29,
},
-- 13
{
28,29,26,27,26,27,28,29,28,29,28,29,
256,256,256,26,27,256,256,256,256,256,256,256,
256,256,256,256,256,256,256,256,73,74,256,256,
256,256,256,98,98,256,256,256,89,90,256,256,
256,256,104,101,102,103,256,256,256,256,256,256,
-- 28,29,28,29,28,29,29,256,81,25,28,29,
28,29,28,29,28,29,29,256,256,1,28,29,
},
-- 14
{
28,29,28,29,28,29,28,29,10,11,28,25,
256,256,256,256,256,256,256,256,10,11,256,25,
256,73,74,256,256,256,256,256,10,11,256,256,
256,89,90,256,256,75,76,256,10,11,256,25,
256,256,256,256,256,91,92,256,10,11,256,25,
28,29,28,29,28,29,28,29,28,29,28,29,
},
-- 15
{
26,27,26,27,28,29,28,29,26,27,26,27,
28,29,256,256,256,256,256,256,256,256,28,24,
256,256,256,256,256,73,74,256,256,256,256,24,
256,256,75,76,256,89,90,256,75,76,256,24,
256,256,91,92,256,256,256,256,91,92,256,24,
26,27,28,29,28,29,28,29,28,29,26,27,
},
-- 16
{
64,256,26,27,28,29,28,29,10,11,28,29,
68,256,66,25,256,256,256,256,10,11,256,256,
256,67,256,256,256,107,108,256,10,11,256,256,
65,256,256,25,256,109,110,256,10,11,256,256,
256,65,256,25,256,256,256,256,10,11,256,256,
256,256,26,27,28,29,28,29,10,11,28,29,
},
-- 17
{
28,29,28,29,25,41,44,45,44,45,44,45,
256,256,256,256,25,41,256,256,256,256,256,256,
256,73,74,256,25,41,256,256,73,74,256,256,
256,89,90,78,25,41,256,256,89,90,256,256,
256,256,95,94,25,41,256,256,10,11,256,256,
28,29,28,29,25,41,44,45,10,11,44,45,
},
-- 18
{
44,45,44,45,41,256,256,41,44,45,44,45,
256,256,256,256,256,69,256,256,256,256,256,256,
256,256,256,256,256,256,69,256,256,256,256,256,
256,256,256,256,256,111,111,256,256,256,256,256,
256,256,256,41,41,256,69,41,41,256,256,256,
45,44,45,42,43,256,256,42,43,44,45,44,
},
-- 19
{
44,45,44,45,42,43,42,43,44,45,44,45,
256,256,256,256,256,40,40,256,256,256,256,256,
256,97,98,97,256,40,40,256,98,97,96,256,
256,99,256,100,256,40,40,256,99,256,100,256,
256,256,256,256,256,40,40,256,256,256,256,256,
-- 3,41,83,256,44,45,44,45,44,45,44,45,
45,3,256,256,44,45,44,45,44,45,44,45,
},
-- 20
{
-- 44,45,256,256,256,42,43,41,42,43,41,41,
44,45,3,256,256,42,43,41,42,43,41,41,
256,256,256,256,41,41,256,256,256,77,42,43,
256,256,256,3,256,41,256,256,256,93,41,41,
256,256,3,256,256,39,256,256,256,256,42,43,
256,3,256,256,256,38,256,256,8,9,41,41,
44,45,44,45,44,45,44,45,8,9,42,43,
},
-- 21
{
34,35,36,37,36,37,36,37,36,37,36,37,
32,256,256,256,256,256,256,256,256,256,256,256,
32,256,97,97,98,256,256,256,97,96,97,256,
32,256,99,256,100,256,256,256,99,256,100,256,
32,256,8,9,256,104,101,102,103,256,256,256,
34,35,8,9,36,37,36,37,36,37,36,37,
},
-- 22
{
36,37,33,33,36,37,36,37,33,33,36,37,
256,256,256,256,256,256,256,256,256,256,256,256,
256,256,256,256,96,97,96,98,256,256,256,256,
256,256,113,256,99,256,256,100,256,114,256,256,
256,256,256,256,256,256,256,256,256,256,256,256,
36,37,36,37,36,37,36,37,36,37,36,37,
},
-- 23
{
-- 37,36,37,36,37,36,37,256,256,256,36,37,
37,36,37,36,37,36,37,2,256,256,36,37,
256,256,256,256,256,256,256,256,256,33,256,256,
256,97,98,97,256,256,112,256,2,256,256,256,
256,99,256,100,256,256,256,2,256,75,76,256,
256,256,256,256,256,256,2,256,256,91,92,256,
36,37,36,37,36,37,36,37,36,37,36,37,
},
-- 24
{
34,35,256,256,256,256,256,256,256,256,34,35,
256,2,34,35,34,35,34,35,34,35,2,256,
256,256,113,256,256,112,114,256,256,114,256,256,
256,256,256,256,256,256,256,256,256,256,256,256,
256,104,101,102,256,101,102,256,101,102,103,256,
36,37,36,37,36,37,36,37,36,37,36,37,
},
-- 25
{
36,37,36,37,36,37,36,37,36,37,34,35,
256,256,256,256,256,256,73,74,256,256,77,32,
256,96,97,96,256,256,89,90,256,256,93,32,
256,99,256,100,256,121,256,256,256,256,256,32,
256,256,256,256,256,101,102,103,8,9,256,32,
36,37,36,37,36,37,36,37,8,9,33,32,
},
-- 26
{
18,19,17,17,18,19,17,17,10,11,18,19,
17,256,256,256,256,256,256,256,10,11,256,256,
18,19,256,256,256,256,256,256,10,11,256,256,
256,17,256,256,256,75,76,256,10,11,256,256,
18,19,256,256,256,91,92,256,10,11,256,256,
20,21,256,256,18,19,17,17,18,19,17,17,
},
-- 27
{
17,17,18,19,17,17,18,19,10,11,18,19,
256,256,256,256,256,256,256,256,10,11,256,256,
256,73,74,256,256,73,74,256,10,11,256,256,
256,89,90,256,256,89,90,256,10,11,256,256,
256,256,256,256,256,256,256,256,10,11,256,256,
-- 17,17,18,19,17,256,80,17,18,19,17,17,
17,17,18,19,17,256,256,0,18,19,17,17,
},
-- 28
{
18,19,17,18,19,256,256,33,33,34,35,33,
256,256,256,17,17,256,69,34,35,72,256,256,
256,256,256,18,19,256,69,33,33,88,256,256,
256,256,256,17,16,256,256,34,35,256,256,256,
256,256,256,18,19,69,256,41,33,256,256,256,
17,18,19,17,17,69,256,34,35,33,33,34,
},
-- 29
{
-- 33,256,256,256,33,33,34,35,33,33,34,35,
33,256,256,2,33,33,34,35,33,33,34,35,
256,33,256,256,256,256,256,256,256,256,256,256,
256,256,2,256,256,256,256,256,256,256,256,256,
256,256,256,2,256,256,256,117,98,106,116,256,
256,256,256,256,2,256,104,101,102,101,102,256,
34,35,33,33,34,35,33,33,34,35,33,33,
},
-- 30
{
33,33,34,35,33,33,34,35,8,9,33,33,
256,256,256,256,256,256,33,33,8,9,34,35,
256,256,256,256,256,97,34,35,8,9,33,33,
256,256,256,256,115,100,33,33,8,9,34,35,
256,256,256,104,101,102,34,35,8,9,33,33,
34,35,33,33,34,35,33,33,8,9,34,35,
},
-- 31
{
40,40,8,9,40,40,40,40,40,40,40,40,
40,45,8,9,45,44,45,44,45,44,45,44,
40,256,8,9,256,256,256,256,256,256,256,256,
40,256,8,9,256,256,112,75,76,113,256,256,
40,256,8,9,256,256,256,91,92,256,256,256,
42,43,44,45,44,45,44,45,44,45,44,45,
},
-- 32
{
40,40,40,40,40,40,40,40,40,40,40,40,
44,45,41,45,44,41,44,45,44,45,44,45,
256,256,38,256,256,38,256,256,256,256,256,256,
256,112,38,256,113,38,256,256,114,256,256,113,
256,256,38,256,256,38,256,256,256,256,256,256,
-- 44,45,41,83,256,44,45,44,45,44,45,44,
44,45,3,256,256,44,45,44,45,44,45,44,
},
-- 33
{
40,40,40,40,40,40,40,40,40,40,40,40,
43,44,45,44,45,42,43,44,45,44,45,42,
256,256,256,256,256,256,256,256,256,256,256,256,
256,256,75,76,256,114,113,256,75,76,256,256,
256,256,91,92,256,256,256,256,91,92,256,256,
44,45,44,45,44,45,44,45,44,45,44,45,
},
-- 34
{
40,40,40,40,40,40,40,40,40,40,40,40,
45,44,45,44,45,44,45,44,45,44,45,40,
256,256,256,256,256,256,256,256,73,74,256,40,
256,256,113,256,256,114,256,121,89,90,256,40,
256,256,256,256,256,256,256,101,102,103,256,40,
-- 44,45,41,83,256,44,45,44,45,44,45,40,
44,45,3,256,256,44,45,44,45,44,45,40,
},
-- 35
{
26,27,28,29,28,29,28,29,8,9,26,27,
24,15,256,256,256,256,256,256,8,9,256,24,
24,256,256,256,256,256,256,256,8,9,256,24,
24,256,256,256,256,256,256,256,8,9,256,24,
24,256,256,256,256,256,256,256,8,9,256,24,
26,27,28,29,28,29,28,29,8,9,26,27,
},
-- 36
{
24,29,256,256,1,25,26,27,25,1,28,29,
24,256,256,256,256,256,25,26,27,256,256,256,
24,256,256,256,256,256,256,256,25,256,256,256,
24,256,106,116,256,256,256,256,38,256,256,256,
24,25,101,102,256,256,256,256,38,256,256,256,
-- 28,29,28,29,25,81,256,28,29,28,29,28,
28,29,28,29,1,256,256,28,29,28,29,28,
},
-- 37
{
-- 29,26,27,28,29,256,256,256,26,27,26,27,
29,26,27,28,29,1,256,256,26,27,26,27,
256,256,256,256,256,256,256,25,256,256,28,29,
256,256,256,256,256,256,1,256,256,256,256,256,
256,112,256,256,256,1,256,256,256,256,113,256,
256,256,256,256,1,256,101,102,103,256,256,256,
28,29,28,29,28,29,28,29,28,29,28,29,
},
-- 38
{
27,26,27,28,29,256,256,28,29,26,27,26,
29,256,256,256,256,256,69,256,256,256,256,28,
256,256,98,96,98,256,256,98,98,96,256,256,
256,256,99,256,100,256,256,99,256,100,256,256,
256,256,256,256,256,111,111,256,256,256,256,256,
29,28,29,28,29,69,256,28,29,28,29,28,
},
-- 39
{
28,29,25,25,28,29,25,25,28,29,25,25,
256,256,25,25,256,256,256,256,256,256,106,24,
256,256,15,256,256,256,256,256,256,256,95,24,
256,256,256,256,78,97,107,108,256,106,105,24,
256,256,256,256,94,101,102,110,103,105,98,24,
28,29,28,29,28,29,28,29,28,29,28,29,
},
-- 40
{
24,29,28,29,28,29,28,29,8,9,26,27,
24,256,256,256,256,256,256,256,8,9,25,25,
24,256,114,256,256,256,112,256,8,9,26,27,
24,256,256,256,256,256,256,256,8,9,25,25,
24,256,256,256,105,256,256,256,8,9,26,27,
24,29,28,29,28,29,28,29,28,29,25,25,
},
-- 41
{
26,27,28,29,28,29,26,27,26,27,28,29,
24,72,256,256,256,256,256,28,29,256,256,256,
24,88,256,256,256,256,256,256,256,256,256,256,
24,256,256,256,112,256,256,256,256,256,114,256,
24,256,256,256,256,256,256,256,256,256,256,256,
-- 28,29,28,29,28,29,25,81,256,28,29,29,
28,29,28,29,28,29,1,256,256,28,29,29,
},
-- 42
{
-- 28,29,256,256,256,1,26,27,26,27,28,29,
28,29,256,256,1,1,26,27,26,27,28,29,
256,256,25,256,256,256,256,28,29,256,256,256,
256,256,256,1,256,256,256,256,256,256,256,256,
256,113,256,256,1,256,256,96,97,96,98,256,
256,256,256,256,256,1,256,101,256,256,102,256,
28,29,28,29,28,29,28,29,28,29,28,29,
},
-- 43
{
28,29,28,29,26,27,26,27,28,29,26,27,
256,256,256,256,256,28,29,256,256,256,77,24,
256,256,256,256,256,256,256,256,256,256,93,24,
256,113,256,256,256,75,76,256,114,256,256,24,
256,256,10,11,256,91,92,256,256,256,256,24,
28,29,10,11,28,29,28,29,28,29,28,29,
},
-- 44
{
-- 33,37,256,256,256,36,37,36,37,36,37,2,
33,37,256,256,2,36,37,36,37,36,37,2,
32,256,33,256,256,256,256,256,256,256,256,256,
32,98,256,2,256,256,256,256,256,256,256,256,
32,99,256,256,2,256,256,256,75,76,256,256,
32,256,256,256,256,2,256,256,91,92,256,256,
36,37,36,37,36,37,36,37,36,37,36,37,
},
-- 45
{
36,37,36,37,36,37,36,37,8,9,34,35,
256,256,256,256,256,256,256,256,8,9,256,32,
256,256,98,97,96,256,256,256,8,9,256,32,
256,256,99,256,100,256,256,256,8,9,256,32,
256,256,256,256,101,102,103,256,8,9,256,32,
36,37,36,37,36,37,36,37,36,37,36,37,
},
-- 46
{
-- 18,19,18,19,256,256,256,20,21,20,21,20,
18,19,18,19,256,256,0,20,21,20,21,20,
18,19,72,256,17,256,256,256,256,256,256,256,
18,19,88,256,256,0,256,256,256,256,256,256,
18,19,256,75,76,78,0,256,256,116,256,256,
18,19,256,91,92,94,95,0,256,101,102,256,
18,19,18,19,18,19,18,19,18,19,18,19,
},
-- 47
{
20,21,20,21,20,21,20,21,20,21,20,21,
256,256,256,256,256,256,256,256,256,256,256,256,
256,97,96,98,97,256,256,96,97,98,96,256,
114,99,256,256,100,114,114,99,256,256,100,114,
256,256,256,256,256,256,256,256,256,256,256,256,
18,19,18,19,18,19,18,19,18,19,18,19,
},
-- 48
{
20,21,20,21,17,256,256,17,20,21,20,21,
256,256,256,256,256,256,69,256,256,256,256,256,
256,256,96,97,256,256,69,256,256,256,256,256,
256,115,99,100,256,256,256,256,256,117,256,256,
256,101,102,103,256,111,111,256,101,102,103,256,
19,18,19,18,19,69,256,18,19,18,19,18,
},
-- 49
{
20,21,256,69,18,19,18,19,20,21,20,21,
256,256,256,256,256,256,256,256,256,256,114,256,
256,256,69,256,256,256,114,256,256,256,256,256,
256,114,69,111,256,256,256,256,17,18,19,17,
256,256,111,256,18,19,18,19,18,19,18,19,
18,19,256,69,17,18,19,18,19,18,19,17,
},
-- 50
{
20,21,20,21,20,21,20,21,20,21,20,16,
256,114,256,256,256,256,256,256,256,256,98,16,
256,256,256,256,256,256,256,256,256,256,100,16,
17,19,256,256,256,114,256,256,256,256,78,16,
18,19,18,19,256,256,256,256,256,256,94,16,
-- 17,18,19,18,19,18,19,256,80,17,18,19,
17,18,19,18,19,18,19,256,256,0,18,19,
},
-- 51
{
-- 42,43,44,45,44,45,256,256,256,44,45,45,
42,43,44,45,44,45,256,256,3,44,45,45,
40,72,256,256,256,256,41,256,256,256,256,256,
40,96,256,256,256,256,256,3,256,256,256,256,
40,99,256,114,256,114,256,256,3,256,256,256,
40,256,256,256,256,256,256,256,256,3,256,256,
44,45,44,45,44,45,44,45,44,45,44,45,
},
-- 52
{
44,45,44,45,44,45,44,45,44,45,44,41,
256,256,256,256,256,256,256,256,256,256,256,40,
256,256,73,74,256,256,256,70,71,256,97,40,
256,256,89,90,256,256,256,86,87,256,100,40,
256,256,256,256,256,256,256,256,256,256,256,40,
-- 44,45,41,83,256,44,44,45,44,45,44,45,
44,45,3,256,256,44,44,45,44,45,44,45,
},
-- 53
{
18,19,10,11,18,19,17,17,20,21,20,21,
16,15,10,11,256,256,256,256,256,256,256,256,
16,256,10,11,256,256,75,76,256,256,256,256,
16,256,10,11,256,256,91,92,256,256,256,256,
16,256,10,11,256,256,18,19,256,256,256,256,
20,21,20,21,20,21,20,21,20,21,20,21,
},
-- 54
{
20,21,20,21,21,17,18,19,67,256,256,256,
256,256,256,256,256,17,18,19,256,65,68,64,
256,256,256,256,256,256,18,19,256,256,256,256,
256,256,256,256,256,256,38,256,67,256,64,256,
256,256,256,256,256,256,38,256,256,256,256,256,
20,21,20,21,20,21,20,21,54,55,54,56,
},
-- 55
{
256,65,256,256,256,67,256,67,256,256,256,256,
256,256,256,64,256,256,256,256,65,68,64,256,
256,256,256,256,256,256,64,256,256,256,256,67,
256,256,65,67,256,256,64,256,256,64,256,256,
256,256,256,256,256,256,256,256,256,256,256,256,
54,55,54,56,56,55,54,56,54,56,55,54,
},
-- 56
{
65,256,256,256,67,256,67,256,256,256,256,64,
256,256,64,256,256,256,256,65,68,64,256,256,
256,256,256,256,256,64,256,256,256,256,67,256,
256,65,67,256,256,64,256,256,64,256,256,256,
256,256,256,256,256,256,256,256,256,256,256,256,
55,54,55,54,56,54,55,56,54,55,54,56,
},
-- 57
{
256,256,256,67,34,35,34,35,34,35,34,35,
256,64,256,256,34,35,72,256,256,256,256,256,
256,256,256,256,34,35,88,256,256,256,256,256,
65,67,256,256,256,38,256,256,75,76,256,256,
256,256,256,256,256,38,256,256,91,92,256,256,
54,55,56,54,36,37,36,37,36,37,36,37,
},
-- 58
{
35,34,35,34,35,69,256,34,35,34,35,34,
256,256,256,256,256,69,256,256,256,256,256,256,
256,113,70,71,114,256,256,112,107,108,113,256,
256,256,86,87,256,256,69,256,109,110,256,256,
256,256,256,256,256,111,111,256,256,256,256,256,
37,36,37,36,37,256,256,36,37,36,37,36,
},
-- 59
{
34,35,256,256,34,35,34,35,34,35,34,35,
256,256,256,69,256,256,256,256,256,256,256,256,
256,256,69,256,256,256,97,96,256,256,256,256,
256,256,111,111,256,256,99,100,256,256,256,256,
256,41,120,119,41,256,256,256,8,9,256,256,
3,41,46,47,41,3,36,37,8,9,36,37,
},
-- 60
{
-- 35,34,35,34,35,34,35,256,256,33,34,35,
35,34,35,34,35,34,35,2,256,256,34,35,
-- 256,256,36,37,256,256,256,256,256,33,34,35,
256,256,36,37,256,256,256,256,256,2,34,35,
256,256,256,256,256,256,256,256,2,77,34,35,
256,256,116,256,256,256,256,2,256,93,34,35,
256,256,101,102,103,256,2,256,256,256,34,35,
36,37,36,37,36,37,36,37,36,37,36,37,
},
-- 61
{
18,19,21,20,21,20,21,20,21,17,18,19,
16,15,256,256,256,256,256,256,256,77,18,19,
16,256,256,256,256,256,256,256,256,93,18,19,
16,256,256,256,256,256,256,116,256,78,18,19,
16,256,10,11,256,256,101,102,256,94,18,19,
20,21,10,11,20,21,20,21,20,21,20,21,
},
-- 62
{
-- 18,19,256,256,256,20,20,21,20,21,20,21,
18,19,256,256,0,0,20,21,20,21,20,21,
16,72,17,256,256,256,256,256,256,256,256,256,
16,88,256,0,256,256,256,256,256,256,256,256,
16,256,256,78,0,256,256,114,75,76,256,256,
16,95,256,94,256,0,256,256,91,92,256,256,
20,21,20,21,20,21,20,21,20,21,20,21,
},
-- 63
{
20,21,20,21,20,21,20,21,20,21,20,17,
256,256,256,256,256,256,256,256,256,256,256,16,
256,256,256,256,256,256,256,256,256,256,98,16,
256,256,256,256,256,256,117,97,96,256,100,16,
256,256,256,256,256,256,101,256,102,103,256,16,
-- 20,21,17,80,256,20,20,21,20,21,20,21,
20,21,0,256,256,20,20,21,20,21,20,21,
},
-- 64
{
41,48,49,48,50,49,48,49,48,50,49,48,
41,256,256,256,256,256,256,256,256,256,256,256,
41,256,256,256,256,256,256,256,256,256,256,256,
41,256,256,256,113,256,256,114,256,256,112,256,
41,256,8,9,256,256,256,256,256,256,256,256,
42,43,8,9,42,43,42,43,42,43,42,43,
},
-- 65
{
48,50,48,49,50,49,50,48,50,49,50,48,
256,256,256,256,256,256,256,256,256,256,112,256,
256,256,256,256,256,256,113,256,256,256,256,256,
256,256,114,256,256,256,256,256,42,43,42,43,
256,256,256,256,42,43,42,43,256,256,256,256,
42,43,42,43,256,256,256,256,256,256,256,256,
},
-- 66
{
48,49,48,48,50,49,48,50,49,48,48,50,
256,113,256,256,114,256,256,256,256,256,256,256,
256,256,256,256,256,256,256,256,256,256,256,256,
42,43,42,43,42,43,256,256,256,112,256,256,
256,256,256,256,42,43,3,256,256,256,256,256,
256,256,256,256,42,43,42,43,42,43,42,43,
},
-- 67
{
50,48,50,49,50,48,50,49,41,42,43,48,
256,256,256,256,256,256,256,256,77,42,43,256,
256,256,256,256,256,256,256,256,93,42,43,256,
256,256,114,256,256,113,256,256,256,42,43,256,
256,256,256,256,256,256,256,256,256,42,43,256,
-- 42,43,41,41,42,43,41,83,256,42,43,50,
42,43,41,41,42,43,3,256,256,42,43,50,
},
-- 68
{
25,28,29,26,27,256,69,26,27,28,29,28,
24,97,256,256,256,256,256,256,256,256,256,256,
24,99,256,256,256,69,256,256,256,256,256,256,
24,256,95,256,113,69,256,256,114,75,76,256,
24,101,102,103,256,111,111,256,256,91,92,256,
28,28,29,28,29,256,69,28,29,28,29,28,
},
-- 69
{
28,29,26,27,26,27,28,29,8,9,28,29,
256,256,256,28,29,256,256,256,8,9,256,256,
256,256,256,256,256,256,256,256,8,9,256,256,
75,76,75,76,75,76,75,76,8,9,256,256,
91,92,91,92,91,92,91,92,8,9,256,256,
28,29,1,26,27,1,28,29,8,9,28,29,
},
-- 70
{
28,29,26,27,25,25,256,256,65,256,256,256,
256,256,256,77,26,27,256,256,256,68,256,256,
256,256,256,93,25,25,256,256,256,256,66,256,
256,256,256,78,26,27,256,66,256,256,256,67,
256,256,95,94,25,25,256,256,256,256,256,256,
28,29,28,29,26,27,54,56,54,56,55,54,
},
-- 71
{
46,47,10,11,46,47,46,47,46,47,46,47,
47,256,10,11,256,256,256,256,256,256,256,256,
47,98,10,11,256,256,256,256,256,256,256,256,
47,99,10,11,256,256,115,105,256,256,256,256,
47,256,10,11,256,256,101,102,103,256,256,256,
46,47,46,47,46,47,46,47,46,47,46,47,
},
-- 72
{
46,47,46,47,46,47,46,47,46,47,46,47,
256,256,256,256,256,256,26,27,26,27,28,29,
256,256,256,256,256,256,38,256,256,256,256,256,
256,256,256,116,256,256,38,256,256,256,256,256,
256,256,101,102,256,256,26,27,26,27,256,256,
46,47,46,47,46,47,46,47,46,47,28,29,
},
-- 73
{
-- 46,47,256,256,256,25,26,27,26,27,26,27,
46,47,256,256,1,25,26,27,26,27,26,27,
28,29,25,256,256,256,256,256,256,28,29,25,
256,256,256,1,256,256,256,116,96,96,256,256,
256,256,256,256,1,256,256,99,256,100,256,256,
256,25,256,256,256,1,256,256,256,256,256,256,
28,29,28,29,26,27,26,27,26,27,26,27,
},
-- 74
{
26,27,8,9,26,27,26,27,26,27,26,27,
25,256,8,9,1,25,28,29,28,29,25,1,
256,256,8,9,256,256,256,256,256,256,256,256,
256,256,8,9,256,256,256,116,106,256,256,256,
256,256,8,9,256,256,104,101,102,103,256,256,
26,27,26,27,26,27,26,27,26,27,26,27,
},
-- 75
{
26,27,26,27,26,27,26,27,26,27,26,27,
256,256,28,29,25,28,29,25,28,29,256,256,
256,256,256,256,256,256,256,256,256,256,256,256,
256,114,256,256,256,113,256,256,256,256,114,256,
256,256,256,256,256,256,256,256,256,256,256,256,
26,27,28,29,28,29,28,29,28,29,26,27,
},
-- 76
{
26,27,26,27,26,27,26,27,18,19,20,21,
256,256,256,256,256,256,15,25,17,15,256,256,
256,256,256,256,256,256,256,25,17,256,256,256,
256,256,256,114,256,256,78,25,17,256,256,256,
256,256,256,256,256,95,94,25,17,256,256,256,
26,27,26,27,26,27,26,27,51,53,52,51,
},
-- 77
{
-- 18,19,18,19,18,19,256,256,256,18,19,52,
18,19,18,19,18,19,256,256,0,18,19,52,
256,256,17,72,256,256,17,256,256,256,256,256,
256,256,38,88,256,113,256,0,256,256,256,256,
256,256,38,256,256,256,256,256,0,256,256,256,
256,256,38,256,256,256,256,256,256,0,256,256,
52,51,52,53,52,53,51,52,51,53,52,53,
},
-- 78
{
51,52,53,51,52,256,256,52,53,51,52,17,
256,256,256,256,256,256,69,256,256,256,256,17,
256,256,256,256,256,69,256,256,256,256,256,17,
256,256,256,256,256,111,111,106,256,256,78,17,
256,256,256,256,17,118,119,17,256,95,94,17,
51,52,53,53,51,53,52,53,51,52,51,17,
},
-- 79
{
256,256,256,256,42,43,42,43,8,9,42,43,
256,256,256,256,42,43,72,256,8,9,256,256,
256,126,127,256,42,43,88,256,8,9,256,256,
256,256,256,256,42,43,256,256,8,9,256,256,
256,256,256,256,42,43,256,256,8,9,256,256,
256,256,256,256,42,43,42,43,42,43,42,43,
},
-- 80
{
42,43,42,43,42,43,42,43,256,256,256,256,
256,256,256,256,256,15,42,43,256,256,256,256,
256,256,256,256,256,256,42,43,256,126,127,256,
256,256,256,256,256,256,42,43,256,256,256,256,
256,256,256,256,256,256,42,43,256,256,256,256,
42,43,42,43,42,43,42,43,256,256,256,256,
},
}
+12 -4
View File
@@ -1,9 +1,16 @@
-- require "map" -- require "map"
tiletype={void=0,nonpc=1,stair=2,switch=3,half=4,block=5} tiletype={void=0,nonpc=1,stair=2,switch=3,half=4,block=5}
mapa={}
mapa.wait=0 mapa.wait=0
mapa.step=0 mapa.step=0
mapa_room_cols = 0
mapa_room_rows = 0
mapa_rooms_per_piso = 0
mapa_pisos = 0
mapa_empty_tile = 0
half_block_set={ half_block_set={
[20] = true, [21] = true, [20] = true, [21] = true,
[22] = true, [28] = true, [22] = true, [28] = true,
@@ -96,11 +103,12 @@ function arc_mapa_update()
end end
end end
function mapa_draw(hab) function mapa_draw(hab)
for ty=0,5 do for ty=0,mapa_room_rows-1 do
for tx=0,11 do for tx=0,mapa_room_cols-1 do
local tile=mapa[1+hab][1+tx+ty*12] local tile=mapa[1+hab][1+tx+ty*mapa_room_cols]
if tile~=256 and (tile<126 or mapa.step>4) then if tile~=mapa_empty_tile and (tile<126 or mapa.step>4) then
-- draw.surf((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 txr = arcade_config.tiles_per_row-1
local txr2 = arcade_config.tiles_per_row_base2 local txr2 = arcade_config.tiles_per_row_base2
+80
View File
@@ -0,0 +1,80 @@
music_info = {
mus_life_ogg = 1.6
}
music_player = {
playlist = {song="", pos=0},
song = "",
playing = false,
pos = 0,
old_pos = 0,
check_time = 0,
}
function music_player:play(song, loop, enqueue)
-- print("MUSIC_PLAYER:PLAY "..song)
if enqueue then
self.playlist.song = self.song
self.playlist.pos = music.pos()
end
-- print( os.clock())
if loop~=nil then
music.play(song, loop)
else
music.play(song)
end
-- print( os.clock())
self.song = song
-- self.old_pos = music.pos()
self.playing = true
self.check_time = os.clock()
end
function music_player:pause()
music.pause()
end
function music_player:resume()
music.resume()
end
function music_player:stop()
music.stop()
end
function music_player:pos()
music.pos()
end
function music_player:enabled()
music.enabled()
end
function music_player:update()
-- self.pos = music.pos()
local curr_time = os.clock()
local song_name = self.song:gsub("%.", "_")
if music_info[song_name]~=nil and curr_time-self.check_time>music_info[song_name] then
-- print("MUSIC_PLAYER:UPDATE "..self.pos.." / "..self.old_pos.." / "..music.pos())
-- if self.pos==self.old_pos then self.playing = false end
self.playing = false
self.old_pos = self.pos
self.check_time = curr_time
end
if not self.playing and self.playlist.song~="" then
self.song = self.playlist.song
self.pos = self.playlist.pos
-- print( os.clock())
music.play(self.song)
-- print( os.clock())
-- music.pos(self.pos)
self.playlist.song = ""
self.playlist.pos = 0
end
end
+70
View File
@@ -0,0 +1,70 @@
one_up_gif_x = 208
one_up_gif_y = 128
one_up={}
function one_up.new(_hab, _x, _y, _y_speed, _max_height, _flip)
_raising = false
if _max_height>0 then _raising=true end
return {
name="one_up",
hab = _hab,
x = _x, y = _y,
w = 16, h = 16,
flip = _flip,
vx=0, vy=0,
y_speed = _y_speed,
max_height = _max_height,
raising = _raising,
enabled=true,
wait = 0,
bb={x=4,y=0,w=9,h=16},
update=one_up.update,
draw=one_up.draw,
}
end
function one_up:draw()
if not self.enabled then return end
local x = one_up_gif_x
local y = one_up_gif_y
local scr_x, scr_y = viewp:screen_coords( self.x, self.y )
draw.surf(x,y,self.w,self.h,scr_x,scr_y,self.w,self.h,self.flip)
-- draw.rect(scr_x+one_up.bb.x,scr_y+one_up.bb.y,one_up.bb.w,one_up.bb.h,3)
end
function one_up:update()
if not self.enabled then return end
if self.raising and self.y_speed>0 then
self.y_speed = -self.y_speed
elseif not self.raising and self.y_speed<0 then
self.y_speed = -self.y_speed
end
local x2_check = self.x+self.bb.x+self.bb.w
local x1_check = self.x+self.bb.x
local y_check = self.y+self.bb.h+self.y_speed
if true then
self.wait=0
self.max_height = self.max_height+self.y_speed
self.y = self.y+self.y_speed
if self.max_height==0 then self.raising=false end
end
self.wait=self.wait+1
local tile1_hit_type= arc_check_tile(x1_check, y_check )
local tile2_hit_type= arc_check_tile(x2_check, y_check)
local block_tile = tile1_hit_type == tiletype.block or tile2_hit_type == tiletype.block
if block_tile then self.y_speed=0 end
self.hab = coords.world_to_tile(self.x, self.y)
if self.hab==abad.hab then
if collision(abad,self) then
abad_lifes_up(1)
self.enabled = false
remove_actor(self)
end
end
end
+2 -1
View File
@@ -21,7 +21,8 @@ function opcions_update()
if key.press(keyShoot) or key.press(key.SPACE) or pad.press(pad.A) or pad.press(btnShoot) or key.press(key.RETURN) then if key.press(keyShoot) or key.press(key.SPACE) or pad.press(pad.A) or pad.press(btnShoot) or key.press(key.RETURN) then
if menu_sel==0 then if menu_sel==0 then
music.enabled(not music.enabled()) music.enabled(not music.enabled())
if music.enabled() then music.play(audio_main_song) end -- if music.enabled() then music.play(audio_main_song) end
if music.enabled() then music_player:play(audio_main_song) end
elseif menu_sel==1 then elseif menu_sel==1 then
sound.enabled(not sound.enabled()) sound.enabled(not sound.enabled())
elseif menu_sel==2 then elseif menu_sel==2 then
+8 -3
View File
@@ -1,21 +1,25 @@
remote_view_wait = 0 remote_view_wait = 0
remote_view_hab = "" remote_view_hab = ""
remote_sf_w = mapa_room_cols*arcade_config.tiles_width remote_sf_w = 0
remote_sf_h = mapa_room_rows*arcade_config.tiles_height remote_sf_h = 0
function remote_view_init () function remote_view_init ()
remote_sf_w = mapa_room_cols*arcade_config.tiles_width
remote_sf_h = mapa_room_rows*arcade_config.tiles_height
sf_remote=surf.new(remote_sf_w, remote_sf_h) sf_remote=surf.new(remote_sf_w, remote_sf_h)
end end
function remote_view(hab) function remote_view(hab)
-- print("REMOTE_VIEW "..hab)
remote_view_hab = hab remote_view_hab = hab
remote_view_wait = 200 remote_view_wait = 200
end end
function remote_view_draw() function remote_view_draw()
if remote_view_wait>0 then if remote_view_wait>0 then
-- print("REMOTE_VIEW_DRAW "..remote_view_hab)
local x,y = coords.room_to_coord ( remote_view_hab ) local x,y = coords.room_to_coord ( remote_view_hab )
-- print("X,Y= "..x.." , "..y)
local curr_source = surf.source() local curr_source = surf.source()
local curr_target = surf.target() local curr_target = surf.target()
@@ -30,6 +34,7 @@ function remote_view_draw()
surf.source(sf_remote) surf.source(sf_remote)
draw.surf(0,0,remote_sf_w,remote_sf_h,11,11,(remote_sf_w/2)-2,(remote_sf_h/2)-2) draw.surf(0,0,remote_sf_w,remote_sf_h,11,11,(remote_sf_w/2)-2,(remote_sf_h/2)-2)
draw.rect(10,10,(remote_sf_w/2),(remote_sf_h/2),2) draw.rect(10,10,(remote_sf_w/2),(remote_sf_h/2),2)
-- print("RSW,RSH= "..remote_sf_w.." , "..remote_sf_h)
surf.source(curr_source) surf.source(curr_source)
remote_view_wait = remote_view_wait-1 remote_view_wait = remote_view_wait-1
end end
+18 -15
View File
@@ -1,6 +1,7 @@
local mini_version = "" local mini_version = ""
local versio_req = {1,5,0} local versio_req = {1,5,13}
local parts = {} local parts = {}
local printed = false
function reqs_init() function reqs_init()
local version=sys.version() local version=sys.version()
@@ -16,32 +17,34 @@ end
function reqs_draw() function reqs_draw()
-- print("LOGO DRAW "..logo_step) -- print("LOGO DRAW "..logo_step)
-- Seleccionar font i destí
-- surf.source(logo_sf)
surf.target(0) surf.target(0)
-- Netejar destí
surf.cls(16) surf.cls(16)
draw.text("Es requerix mini "..table.concat(versio_req, "."),20,20,2) local str1 = "Es requerix mini "..table.concat(versio_req, ".")
draw.text("Executant amb mini "..table.concat(parts, "."),20,30,2) local str2 = "Executant amb mini "..table.concat(parts, ".")
draw.text(str1,20,20,2)
draw.text(str2,20,30,2)
if not printed then
print(str1)
print(str2)
printed = true
end
end end
function reqs_end() function reqs_end()
-- print("LOGO_END") -- print("LOGO_END")
-- game_update = intro_init
states:executar("logo") states:executar("logo")
-- surf.free(logo_sf)
end end
function reqs_update() function reqs_update()
if parts[1]>versio_req[1] then if parts[1]<versio_req[1] then
states:next()
elseif parts[2]>versio_req[2] then
states:next()
elseif parts[3]>=versio_req[3] then
states:next()
else
reqs_draw() reqs_draw()
elseif parts[2]<versio_req[2] then
reqs_draw()
elseif parts[3]<versio_req[3] then
reqs_draw()
else
states:next()
end end
if controller:check("ESC") or controller:check("shoot") then if controller:check("ESC") or controller:check("shoot") then
+19 -23
View File
@@ -191,12 +191,12 @@ scenes={
} }
function start_scene(_scene, offset, stop_music) function start_scene(_scene, offset, stop_music)
--bkg=newsurf(128,96) if stop_music then
--setdest(bkg) print("STOP MUSIC")
--setsource(0) elseif _scene[1].musica then
--draw.surf(0,0,128,96,0,0) print("PLAY ".._scene[1].musica)
--setsource(tiles) end
--setdest(0)
scenes.current_scene=_scene scenes.current_scene=_scene
scenes.dnum=1 scenes.dnum=1
scenes.step=0 scenes.step=0
@@ -205,15 +205,15 @@ function start_scene(_scene, offset, stop_music)
scenes.offset=28 scenes.offset=28
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)
music.play(scenes.current_scene[scenes.dnum].musica) -- music.play(scenes.current_scene[scenes.dnum].musica)
music_player: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
-- game_update=update_scene
scene.running = true scene.running = true
if not stop_music then scene.stop_music = false end if not stop_music then scene.stop_music = false end
-- print("SCENE START") print("SCENE START")
states:executar("scene", true); -- guardar l'estat anterior i executar states:executar("scene", true); -- guardar l'estat anterior i executar
end end
@@ -242,29 +242,24 @@ end
function play_music() function play_music()
if scenes.current_scene[scenes.dnum].musica then if scenes.current_scene[scenes.dnum].musica then
-- print("PLAY MUSIC "..scenes.dnum) -- print("PLAY MUSIC "..scenes.dnum)
music.stop() -- music.stop()
music.play(scenes.current_scene[scenes.dnum].musica) -- music.play(scenes.current_scene[scenes.dnum].musica)
music_player:stop()
music_player:play(scenes.current_scene[scenes.dnum].musica)
end end
end end
function draw_abad_with_mood(mood, dx, dy, dw, dh) function draw_abad_with_mood(mood, dx, dy, dw, dh)
local ox, oy =view.origin() local ox, oy =view.origin()
view.origin(0,0) view.origin(0,0)
-- -- composicio -- composicio
local curr_sf = surf.target() local curr_sf = surf.target()
surf.target(avatar_sf) surf.target(avatar_sf)
surf.cls(16) surf.cls(16)
draw.surf(scenes.current_scene[scenes.dnum].x,scenes.current_scene[scenes.dnum].y,avatar_w,avatar_h,0,0,avatar_w,avatar_h) draw.surf(scenes.current_scene[scenes.dnum].x,scenes.current_scene[scenes.dnum].y,avatar_w,avatar_h,0,0,avatar_w,avatar_h)
abad_add_mood(0,scenes.current_scene[scenes.dnum].x,0,scenes.current_scene[scenes.dnum].y,false,mood) abad_add_mood(0,scenes.current_scene[scenes.dnum].x,0,scenes.current_scene[scenes.dnum].y,false,mood)
-- if mood=="sorpresa" then
-- draw.surf(240,0,11,4,16-scenes.current_scene[scenes.dnum].x,5-scenes.current_scene[scenes.dnum].y,11,4)
-- elseif mood=="enfadat" then
-- draw.surf(240,4,11,4,16-scenes.current_scene[scenes.dnum].x,5-scenes.current_scene[scenes.dnum].y,11,4)
-- elseif mood=="interessant" then
-- draw.surf(240,8,11,4,16-scenes.current_scene[scenes.dnum].x,5-scenes.current_scene[scenes.dnum].y,11,4)
-- else
-- abad.mood="normal"
-- end
-- Dibuixar -- Dibuixar
view.origin(ox, oy) view.origin(ox, oy)
surf.target(curr_sf) surf.target(curr_sf)
@@ -392,6 +387,7 @@ function update_scene()
if scenes.die==0 then if scenes.die==0 then
if scenes.dnum==#scenes.current_scene then if scenes.dnum==#scenes.current_scene then
if scene.stop_music then music.stop() end if scene.stop_music then music.stop() end
-- if batman.endgame then -- if batman.endgame then
-- final_init() -- final_init()
-- fade.fadeoutin() -- fade.fadeoutin()
+82 -46
View File
@@ -1,13 +1,40 @@
function stages.stage1_init() function stages.stage1_init()
-- stagemgr init
stages.actors={} stages.actors={}
stages.boss_loaded = false
stages.boss_ready = false
stages.boss_finished = false
boss = nil
-- actors={}
-- mapa init
mapa = stage1_mapa mapa = stage1_mapa
mapa_room_cols = s01_mapa_room_cols
mapa_room_rows = s01_mapa_room_rows
mapa_rooms_per_piso = s01_mapa_rooms_per_piso
mapa_pisos = s01_mapa_pisos
mapa_empty_tile = s01_mapa_empty_tile
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
mapa.tobatcave = false mapa_surface_init()
load_tilemap( sf_mapa ) load_tilemap( sf_mapa )
mapa.tobatcave = false
coords.set_config({
tiles_width = arcade_config.tiles_width,
tiles_height = arcade_config.tiles_height,
room_cols = mapa_room_cols,
room_rows = mapa_room_rows,
rooms_per_floor = mapa_rooms_per_piso,
})
remote_view_init()
-- actors init
llibre.init() llibre.init()
table.insert(actors,llibre) table.insert(actors,llibre)
@@ -30,8 +57,6 @@ function stages.stage1_init()
table.insert( actors, boss ) table.insert( actors, boss )
boss_meter = bar_meter.new(20,12,128,10,1,1,boss,5) boss_meter = bar_meter.new(20,12,128,10,1,1,boss,5)
--batman
bol.init() bol.init()
table.insert(actors,bol) table.insert(actors,bol)
@@ -103,10 +128,10 @@ function stages.stage1_init()
local hp_x, hp_y = coords.room_to_world(69, 9, 3) local hp_x, hp_y = coords.room_to_world(69, 9, 3)
table.insert( actors, health_potion.new(77, hp_x, hp_y, 0, 0, 1) ) table.insert( actors, health_potion.new(77, hp_x, hp_y, 0, 0, 1) )
-- TRIGGERS -- TRIGGERS
-- if not menu then table.insert(actors,trigger.new(10,57,32,triggers.escena_abad_inici)) end -- if not menu then table.insert(actors,trigger.new(10,57,32,triggers.escena_abad_inici)) end
table.insert( actors, trigger.new(10,7,3,triggers.escena_abad_inici,"inici","TR01") ) table.insert( actors, trigger.new(10,7,3,triggers.escena_abad_inici,"inici","TR01") )
table.insert( actors, trigger.new(10,8,3,triggers.start_bg_music,"musica") )
table.insert( actors, trigger.new(11,2,3,triggers.escena_abad_corfes,"corfes","TR02") ) table.insert( actors, trigger.new(11,2,3,triggers.escena_abad_corfes,"corfes","TR02") )
table.insert( actors, trigger.new(31,1,3,triggers.escena_abad_portes,"portes","TR03") ) table.insert( actors, trigger.new(31,1,3,triggers.escena_abad_portes,"portes","TR03") )
@@ -128,17 +153,11 @@ function stages.stage1_init()
table.insert( actors, trigger.new(75,6,1,triggers.open_door,"","pasillo inf","switch",{77, 50,38,26}) ) table.insert( actors, trigger.new(75,6,1,triggers.open_door,"","pasillo inf","switch",{77, 50,38,26}) )
table.insert( actors, trigger.new(75,9,1,triggers.open_door,"","acces inf casa batman","switch",{57, 53,41},{"TR07"}) ) table.insert( actors, trigger.new(75,9,1,triggers.open_door,"","acces inf casa batman","switch",{57, 53,41},{"TR07"}) )
table.insert( actors, trigger.new(79,5,1,triggers.open_door,"","sotan casa batman","switch",{36, 56,44}) ) table.insert( actors, trigger.new(79,5,1,triggers.open_door,"","sotan casa batman","switch",{36, 56,44}) )
table.insert( actors, trigger.new(38,2,2,triggers.open_door,"","","switch",{39, 62,63}) ) table.insert( actors, trigger.new(38,2,2,triggers.add_1up,"","","switch",{39, 62,63}) )
table.insert( actors, trigger.new(35,1,3,triggers.open_door,"","batman a casa abad (1/2)","invisible",{36, 12,24 }) ) table.insert( actors, trigger.new(35,1,3,triggers.open_door,"","batman a casa abad (1/2)","invisible",{36, 12,24 }) )
table.insert( actors, trigger.new(35,1,3,triggers.open_door,"","batman a casa abad (2/2)","invisible",{35, 23,35 }) ) table.insert( actors, trigger.new(35,1,3,triggers.open_door,"","batman a casa abad (2/2)","invisible",{35, 23,35 }) )
-- table.insert( actors, trigger.new(1, 1,1,triggers.open_door,"","acces cacaus","switch",{20, 53,41},{"TR08"})) -- Dialegs
-- table.insert(actors,trigger.new(14,40,32,triggers.teleport_a))
-- table.insert(actors,trigger.new(67,8,32,triggers.teleport_b))
-- table.insert(actors,trigger.new(29,40,32,triggers.teleport_c))
-- table.insert(actors,trigger.new(61,8,32,triggers.teleport_d))
trigger_event.new("Premiere dialeg 1", trigger_event.new("Premiere dialeg 1",
trigger_ev.dialeg_trigger, trigger_ev.dialeg_trigger,
trigger_ev.dialeg_init, trigger_ev.dialeg_init,
@@ -183,49 +202,19 @@ function stages.stage1_init()
tiles_layer2.new(76,3,2,128,208,16,16, tiles_layer2.update_aranya, tiles_layer2.draw_aranya) tiles_layer2.new(76,3,2,128,208,16,16, tiles_layer2.update_aranya, tiles_layer2.draw_aranya)
tiles_layer2.new(78,6,2,128,208,16,16, tiles_layer2.update_aranya, tiles_layer2.draw_aranya) tiles_layer2.new(78,6,2,128,208,16,16, tiles_layer2.update_aranya, tiles_layer2.draw_aranya)
-- table.insert( actors, sign.new(10, 6 , 3, 0, false) ) -- L -- abad init
abad.vehicle = ""
local abad_x, abad_y = coords.room_to_world ( 10, 4, 3 ) local abad_x, abad_y = coords.room_to_world ( 10, 4, 3 )
-- local abad_x, abad_y = coords.room_to_world ( 54, 8, 3 ) -- local abad_x, abad_y = coords.room_to_world ( 54, 8, 3 )
-- table.insert( actors, trigger.new(8,4,3,triggers.escena_stage1_ending,"stage1 ending","TR09") ) -- local abad_x, abad_y = coords.room_to_world ( 8, 9, 3 )
-- local abad_x, abad_y = coords.room_to_world ( 8, 9, 3 )
abad:move(abad_x, abad_y) abad:move(abad_x, abad_y)
abad_make_safe( true ) abad_make_safe( true )
-- viewport init
local scr_ax, scr_ay = viewp:screen_coords(abad_x, abad_y) local scr_ax, scr_ay = viewp:screen_coords(abad_x, abad_y)
remote_view_init()
viewp:free_move() viewp:free_move()
end end
function stages.stage1_toBatcave()
local switches_enabled = 0
if mapa.tobatcave then return end
for key,actor in pairs(actors) do
if actor.type=="switch" and actor.enabled then
switches_enabled = switches_enabled +1
end
end
if switches_enabled<=2 then
mapa.tobatcave = true
table.insert( stages.actors, sign.new(76, 8 , 1, 0, true) ) -- L
table.insert( stages.actors, sign.new(73, 10, 3, 0, true) ) -- L
table.insert( stages.actors, sign.new(72, 5 , 1, 0, true) ) -- L
-- table.insert( stages.actors, sign.new(61, 6 , 1, 0, true) ) -- L
-- table.insert( stages.actors, sign.new(50, 9 , 1, 0, true) ) -- L
table.insert( stages.actors, sign.new(41, 5, 3, 0, false) ) -- R
-- table.insert( actors, sign.new(40, 10, 3, 0, false) ) -- R
-- table.insert( actors, sign.new(42, 1 , 2, 90, false) ) -- D
table.insert( stages.actors, sign.new(53, 4 , 3, 0, false) ) -- R
-- print("GO TO BATCAVE")
end
end
function stages.stage1_update() function stages.stage1_update()
stages.stage1_toBatcave() stages.stage1_toBatcave()
for key,actor in pairs(stages.actors) do for key,actor in pairs(stages.actors) do
@@ -254,6 +243,53 @@ function stages.stage1_draw_front()
-- boss_meter:draw() -- boss_meter:draw()
end end
function stages.stage1_bg_music()
music_player:play(audio_song_premiere)
end
function stages.stage1_viewport_update()
-- Moure el viewport
local vp_x = viewp.x
local vp_y = viewp.y
local vp_center_offset_x = (viewp.width // 2)
local vp_center_offset_y = (viewp.height // 2)
vp_x = abad.x+(abad.w/2) - vp_center_offset_x
if vp_x < 0 then vp_x = 0 end
vp_y = abad.y - vp_center_offset_y
if vp_y < 0 then vp_y = 0 end
viewp:position(vp_x, vp_y)
end
function stages.stage1_toBatcave()
local switches_enabled = 0
if mapa.tobatcave then return end
for key,actor in pairs(actors) do
if actor.type=="switch" and actor.enabled then
switches_enabled = switches_enabled +1
end
end
if switches_enabled<=2 then
mapa.tobatcave = true
table.insert( stages.actors, sign.new(76, 8 , 1, 0, true) ) -- L
table.insert( stages.actors, sign.new(73, 10, 3, 0, true) ) -- L
table.insert( stages.actors, sign.new(72, 5 , 1, 0, true) ) -- L
-- table.insert( stages.actors, sign.new(61, 6 , 1, 0, true) ) -- L
-- table.insert( stages.actors, sign.new(50, 9 , 1, 0, true) ) -- L
table.insert( stages.actors, sign.new(41, 5, 3, 0, false) ) -- R
-- table.insert( actors, sign.new(40, 10, 3, 0, false) ) -- R
-- table.insert( actors, sign.new(42, 1 , 2, 90, false) ) -- D
table.insert( stages.actors, sign.new(53, 4 , 3, 0, false) ) -- R
-- print("GO TO BATCAVE")
end
end
require "stage1_world_map" require "stage1_world_map"
require "stage1_boss_map" require "stage1_boss_map"
require "stage1_boss" require "stage1_boss"
+12 -30
View File
@@ -11,23 +11,6 @@ function stages.stage1_boss_ready()
stages.boss_finished = false stages.boss_finished = false
end end
-- function stages.stage1_boss()
-- -- if not scene.running and not stages.boss_loaded then
-- load_tilemap( sf_mapa, stage1_boss_mapa )
-- -- actors_in_room_backup_and_remove(stage1_boss_mapa.r0.r,stage1_boss_mapa.r1.r)
-- -- viewp:fixed({l=8,r=44,u=48,d=0}, viewp.x, viewp.y-48)
-- -- viewp:fixed({l=8,r=44,u=0,d=0})
-- stages.boss_loaded = true
-- boss.reason=""
-- boss.enabled=true
-- boss:fight()
-- trigger_event.new("Premiere Boss 1",
-- trigger_ev.premiere_boss1_trigger,
-- trigger_ev.premiere_healer_init,
-- premiere.healer_update)
-- -- end
-- end
function stages.stage1_boss_update() function stages.stage1_boss_update()
-- print("stage1_update") -- print("stage1_update")
fireball.update() fireball.update()
@@ -51,22 +34,21 @@ function stages.stage1_boss_draw_front()
boss_meter:draw() boss_meter:draw()
end end
function stages.stage1_boss_bg_music()
-- music_player:play(audio_song_premiere)
end
function stages.stage1_boss_viewport_update()
-- Moure el viewport
stages.stage1_viewport_update()
end
function stages.stage1_boss_finished() function stages.stage1_boss_finished()
stages.boss_ready = true stages.boss_ready = true
stages.boss_finished = true stages.boss_finished = true
end end
-- function stages.stage1_boss_end()
-- mapa_restore_backup()
-- set_actors_enabled_by_room(true, "boss", stage1_boss_mapa.r0.r, stage1_boss_mapa.r1.r)
-- remove_actor(boss)
-- stages.boss_ready = false
-- stages.boss_finished = false
-- stages.boss_loaded = false
-- viewp:free_move()
-- end
-- INTRO FUNCTIONS -- INTRO FUNCTIONS
function stages.stage1_boss_intro_init() function stages.stage1_boss_intro_init()
trigger_event.new("Premiere Boss 1", trigger_event.new("Premiere Boss 1",
@@ -75,7 +57,7 @@ function stages.stage1_boss_intro_init()
premiere.healer_update) premiere.healer_update)
load_tilemap( sf_mapa, stage1_boss_mapa ) load_tilemap( sf_mapa, stage1_boss_mapa )
set_actors_enabled_by_room(false, "boss", stage1_boss_mapa.r0.r, stage1_boss_mapa.r1.r) set_actors_enabled_by_room(false, "boss", stage1_boss_mapa.r0.r, stage1_boss_mapa.r1.r)
viewp:fixed({l=8,r=44,u=0,d=0}, viewp.x, viewp.y-48) viewp:fixed({l=24,r=28,u=0,d=0}, viewp.x, viewp.y-48)
boss.enabled=true boss.enabled=true
boss.reason="" boss.reason=""
boss:fight() boss:fight()
@@ -86,7 +68,7 @@ end
function stages.stage1_boss_intro_update() function stages.stage1_boss_intro_update()
if stage1_boss.time==0 then if stage1_boss.time==0 then
start_scene(scenes.lluita_imp, nil, false) -- start_scene(scenes.lluita_imp, nil, false)
stages.stage1_boss_ready() stages.stage1_boss_ready()
end end
+3 -8
View File
@@ -42,18 +42,13 @@ function stage1_ending:update_scene()
premiere.update() premiere.update()
elseif self.time==400 then elseif self.time==400 then
premiere.stage1_ending_init3() premiere.stage1_ending_init3()
copter.hab=premiere.hab copter.init(premiere)
copter.x=premiere.x
copter.y=premiere.y
-- copter.init()
copter.y=copter.y-16
table.insert( actors, copter) table.insert( actors, copter)
music.play(audio_song_copter) -- music.play(audio_song_copter)
music_player:play(audio_song_copter)
elseif self.time<720 then elseif self.time<720 then
-- sisena escena - premiere copter -- sisena escena - premiere copter
premiere.update() premiere.update()
copter.x = premiere.x-32
copter.y = premiere.y-48
copter.update() copter.update()
elseif self.time==720 then elseif self.time==720 then
start_scene(scenes.stage1_ending_3, nil, false) start_scene(scenes.stage1_ending_3, nil, false)
+6
View File
@@ -1,3 +1,9 @@
s01_mapa_room_cols = 12; -- en quantitat de tiles
s01_mapa_room_rows = 6; -- en quantitat de tiles
s01_mapa_rooms_per_piso = 10
s01_mapa_pisos = 8
s01_mapa_empty_tile = 256
stage1_mapa={ stage1_mapa={
-- 1 -- 1
{ {
+64 -245
View File
@@ -1,249 +1,55 @@
stages = {}
stages.actors={} function stages.stage2_init()
stages.boss_loaded = false -- stagemgr init
stages.boss_ready = false
stages.boss_finished = false
boss = nil
function stages.stage1_init()
stages.actors={} stages.actors={}
mapa = stage1_mapa stages.boss_loaded = false
stages.boss_ready = false
stages.boss_finished = false
boss = nil
actors={}
-- mapa init
mapa = stage2_mapa
mapa_room_cols = s02_mapa_room_cols
mapa_room_rows = s02_mapa_room_rows
mapa_rooms_per_piso = s02_mapa_rooms_per_piso
mapa_pisos = s02_mapa_pisos
mapa_empty_tile = s02_mapa_empty_tile
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
mapa.tobatcave = false mapa_surface_init()
load_tilemap( sf_mapa ) load_tilemap( sf_mapa )
coords.set_config({
tiles_width = arcade_config.tiles_width,
tiles_height = arcade_config.tiles_height,
room_cols = mapa_room_cols,
room_rows = mapa_room_rows,
rooms_per_floor = mapa_rooms_per_piso,
})
llibre.init() -- actors init
table.insert(actors,llibre)
gorro.init()
table.insert(actors,gorro)
peu.init()
table.insert(actors,peu)
premiere.init()
table.insert(actors,premiere)
elalien.init()
table.insert(actors,elalien)
batvio.init() batvio.init()
table.insert(actors,batvio) table.insert(actors,batvio)
boss = imp.new(55,4,3)
table.insert( actors, boss )
boss_meter = bar_meter.new(20,12,128,10,1,1,boss,5)
--batman
bol.init()
table.insert(actors,bol)
table.insert( actors, gota.new(70,5,1,20) )
table.insert( actors, gota.new(70,9,1,30) )
table.insert( actors, gota.new(63,5,1,25,2,-7) )
table.insert( actors, gota.new(63,9,1,20,0,-8) )
table.insert( actors, gota.new(64,3,1,10,0,-6) )
table.insert( actors, gota.new(64,6,1,25,-1,-5) )
table.insert( actors, gota.new(65,7,1,10,0,-7) )
table.insert( actors, gota.new(65,8,1,25,0,-7) )
table.insert( actors, gota.new(66,3,1,10,0,-7) )
table.insert( actors, gota.new(66,4,1,15,0,-7) )
table.insert( actors, gota.new(77,2,1,30,-5,-7) )
table.insert( actors, gota.new(77,9,1,25,-5,-7) )
-- FOC?
table.insert(actors,invisible.new(77,5,4))
table.insert(actors,invisible.new(77,6,4))
table.insert(actors,invisible.new(58,2,4))
table.insert(actors,invisible.new(58,3,4))
table.insert( actors, caco.new(13,3,2,true ) )
table.insert( actors, caco.new(17,3,2,false) )
table.insert( actors, caco.new(20,3,2,false) )
table.insert( actors, caco.new(26,3,2,false) )
table.insert( actors, caco.new(30,4,2,false) )
table.insert( actors, caco.new(37,3,2,false) )
table.insert( actors, caco.new(41,3,2,false) )
table.insert( actors, caco.new(40,3,2,false) )
table.insert( actors, caco.new(45,3,2,false) )
table.insert( actors, caco.new(50,3,2,false) )
table.insert( actors, caco.new(57,3,2,false) )
table.insert( actors, caco.new(61,3,2,false) )
table.insert( actors, caco.new(74,3,2,false) )
table.insert( actors, caco.new(75,3,2,false) )
local zombie1 = zombie.new(2, 3, 3,false)
table.insert( actors, zombie1 )
table.insert( actors, zombie.new(2, 4, 3,true) )
table.insert( actors, zombie.new(2, 5, 3,false) )
table.insert( actors, zombie.new(3, 3, 3,true) )
table.insert( actors, zombie.new(23, 0, 3,false) )
table.insert( actors, zombie.new(23, 9, 3,true) )
table.insert( actors, zombie.new(24, 6, 3,true) )
table.insert( actors, zombie.new(28, 3, 3,false) )
table.insert( actors, zombie.new(32, 3, 3,false) )
table.insert( actors, zombie.new(42, 7, 3,true) )
table.insert( actors, zombie.new(43, 3, 3,true) )
table.insert( actors, zombie.new(44, 3, 3,false) )
table.insert( actors, zombie.new(46, 3, 3,false,2) )
table.insert( actors, zombie.new(46, 1, 3,false) )
table.insert( actors, zombie.new(47, 1, 3,true) )
table.insert( actors, zombie.new(47, 9, 3,false) )
table.insert( actors, zombie.new(54, 3, 3,false) )
table.insert( actors, zombie.new(59, 1, 3,false) )
table.insert( actors, zombie.new(67, 8, 3,false,2) )
table.insert( actors, zombie.new(68, 3, 3,false) )
local zombie2 = zombie.new(73, 3, 3,false)
table.insert( actors, zombie2 )
table.insert( actors, zombie.new(73, 5, 3,false) )
table.insert( actors, zombie.new(73, 7, 3,false) )
table.insert( actors, zombie.new(75, 3, 3,true) )
local hp_x, hp_y = coords.room_to_world(14, 10, 4)
table.insert( actors, health_potion.new(14, hp_x, hp_y, 0, 0, 2) )
local hp_x, hp_y = coords.room_to_world(77, 8, 4)
table.insert( actors, health_potion.new(77, hp_x, hp_y, 0, 0, 3) )
local hp_x, hp_y = coords.room_to_world(69, 9, 3)
table.insert( actors, health_potion.new(77, hp_x, hp_y, 0, 0, 1) )
-- TRIGGERS
-- if not menu then table.insert(actors,trigger.new(10,57,32,triggers.escena_abad_inici)) end
table.insert( actors, trigger.new(10,7,3,triggers.escena_abad_inici,"inici","TR01") )
table.insert( actors, trigger.new(11,2,3,triggers.escena_abad_corfes,"corfes","TR02") )
table.insert( actors, trigger.new(31,1,3,triggers.escena_abad_portes,"portes","TR03") ) -- abad init
table.insert( actors, trigger.new(31,6,3,triggers.escena_abad_portes,"portes","TR04") ) abad.vehicle = "copter"
table.insert( actors, trigger.new(71,7,3,triggers.escena_abad_portes,"portes","TR05") ) local abad_x, abad_y = coords.room_to_world ( 1, 4, 3 )
table.insert( actors, trigger.new(53,5,3,triggers.escena_abad_porta_casa,"porta casa","TR06"))
table.insert( actors, trigger.new(56,4,3,triggers.escena_abad_porta_batman,"porta batman","TR07"))
table.insert( actors, trigger.new(19,4,3,triggers.escena_habitacio_batman,"habitacio batman","TR08"))
--
table.insert( actors, trigger.new(55,1,3,triggers.escena_lluita_imp,"lluita imp"))
-- La definició de les portes en en inici 1, la del trigger en inici 0
table.insert( actors, trigger.new(10,8,1,triggers.open_door,"","primera porta","switch",{11, 57,45}) )
table.insert( actors, trigger.new(34,1,1,triggers.open_door,"","dos portes casa abad","switch",{32, 50,38,26,53,41,29},{"TR03","TR04"}) )
table.insert( actors, trigger.new(52,1,1,triggers.open_door,"","porta casa abad","switch",{72, 42,30},{"TR05"}) )
table.insert( actors, trigger.new(60,1,1,triggers.open_door,"","altillo","switch",{54, 54,42},{"TR06"}) )
table.insert( actors, trigger.new(75,6,1,triggers.open_door,"","pasillo inf","switch",{77, 50,38,26}) )
table.insert( actors, trigger.new(75,9,1,triggers.open_door,"","acces inf casa batman","switch",{57, 53,41},{"TR07"}) )
table.insert( actors, trigger.new(79,5,1,triggers.open_door,"","sotan casa batman","switch",{36, 56,44}) )
table.insert( actors, trigger.new(38,2,2,triggers.open_door,"","","switch",{39, 62,63}) )
table.insert( actors, trigger.new(35,1,3,triggers.open_door,"","batman a casa abad (1/2)","invisible",{36, 12,24 }) )
table.insert( actors, trigger.new(35,1,3,triggers.open_door,"","batman a casa abad (2/2)","invisible",{35, 23,35 }) )
-- table.insert( actors, trigger.new(1, 1,1,triggers.open_door,"","acces cacaus","switch",{20, 53,41},{"TR08"}))
-- table.insert(actors,trigger.new(14,40,32,triggers.teleport_a))
-- table.insert(actors,trigger.new(67,8,32,triggers.teleport_b))
-- table.insert(actors,trigger.new(29,40,32,triggers.teleport_c))
-- table.insert(actors,trigger.new(61,8,32,triggers.teleport_d))
trigger_event.new("Premiere dialeg 1",
trigger_ev.dialeg_trigger,
trigger_ev.dialeg_init,
nil,
premiere, abad, 150, "Ma que cosa fare", 150, 0, true)
trigger_event.new("Zombie 1 dialeg",
trigger_ev.dialeg_trigger,
trigger_ev.dialeg_init,
nil,
zombie1, abad, 150, "Sereeeeebrooooosssss", 250, nil, true)
trigger_event.new("Zombie 2 dialeg",
trigger_ev.dialeg_trigger,
trigger_ev.dialeg_init,
nil,
zombie2, abad, 150, "Aaaaaargh... per ell!", 250, nil, true)
trigger_event.new("Elalien dialeg",
trigger_ev.dialeg_trigger,
trigger_ev.dialeg_init,
nil,
elalien, abad, 150, "I les tisores de podar?", 250, nil, true)
trigger_event.new("Abad dialeg",
trigger_ev.dialeg_trigger,
trigger_ev.dialeg_init,
nil,
abad, bol, 150, "Mmmm fa olor a cacaus...", 80, 49, false)
tiles_layer2.new(13,11,3,144,144,16,16)
tiles_layer2.new(13,11,4,144,144,16,16)
tiles_layer2.new(34,11,1,128,144,16,16)
tiles_layer2.new(34,11,2,128,144,16,16)
tiles_layer2.new(35, 0,1,128,144,16,16)
tiles_layer2.new(35, 0,2,128,144,16,16)
tiles_layer2.new(69,4,2,160,144,16,16)
tiles_layer2.new(69,5,2,176,144,16,16)
tiles_layer2.new(69,4,3,160,144,16,16)
tiles_layer2.new(69,5,3,176,144,16,16)
tiles_layer2.new(12,5,2,128,208,16,16, tiles_layer2.update_aranya, tiles_layer2.draw_aranya)
tiles_layer2.new(76,3,2,128,208,16,16, tiles_layer2.update_aranya, tiles_layer2.draw_aranya)
tiles_layer2.new(78,6,2,128,208,16,16, tiles_layer2.update_aranya, tiles_layer2.draw_aranya)
-- table.insert( actors, sign.new(10, 6 , 3, 0, false) ) -- L
local abad_x, abad_y = coords.room_to_world ( 10, 4, 3 )
-- local abad_x, abad_y = coords.room_to_world ( 54, 8, 3 )
-- table.insert( actors, trigger.new(8,4,3,triggers.escena_stage1_ending,"stage1 ending","TR09") )
-- local abad_x, abad_y = coords.room_to_world ( 8, 9, 3 )
abad:move(abad_x, abad_y) abad:move(abad_x, abad_y)
abad_make_safe( true ) abad_make_safe( true )
table.insert(actors,copter)
copter.init(abad)
-- viewport init
local scr_ax, scr_ay = viewp:screen_coords(abad_x, abad_y) local scr_ax, scr_ay = viewp:screen_coords(abad_x, abad_y)
remote_view_init()
viewp:free_move() viewp:free_move()
stages.boss_ready = false
stages.boss_loaded = false
end end
function stages.stage1_toBatcave() function stages.stage2_update()
local switches_enabled = 0
if mapa.tobatcave then return end
for key,actor in pairs(actors) do
if actor.type=="switch" and actor.enabled then
switches_enabled = switches_enabled +1
end
end
if switches_enabled<=2 then
mapa.tobatcave = true
table.insert( stages.actors, sign.new(76, 8 , 1, 0, true) ) -- L
table.insert( stages.actors, sign.new(73, 10, 3, 0, true) ) -- L
table.insert( stages.actors, sign.new(72, 5 , 1, 0, true) ) -- L
-- table.insert( stages.actors, sign.new(61, 6 , 1, 0, true) ) -- L
-- table.insert( stages.actors, sign.new(50, 9 , 1, 0, true) ) -- L
table.insert( stages.actors, sign.new(41, 5, 3, 0, false) ) -- R
-- table.insert( actors, sign.new(40, 10, 3, 0, false) ) -- R
-- table.insert( actors, sign.new(42, 1 , 2, 90, false) ) -- D
table.insert( stages.actors, sign.new(53, 4 , 3, 0, false) ) -- R
print("GO TO BATCAVE")
end
end
function stages.stage1_update()
-- print("stage1_update")
-- fireball.update()
-- if (abad.energia<=abad.max_energia/2) then
-- -- Requeriment: tindre mitja clau
-- premiere.healer_init()
-- end
stages.stage1_toBatcave()
for key,actor in pairs(stages.actors) do for key,actor in pairs(stages.actors) do
if viewp:inside(actor.x, actor.y, actor.w, actor.h) and actor~=abad then if viewp:inside(actor.x, actor.y, actor.w, actor.h) and actor~=abad then
actor:update() actor:update()
@@ -251,8 +57,7 @@ function stages.stage1_update()
end end
end end
function stages.stage1_draw_back() function stages.stage2_draw_back()
-- print("stage1_draw_back")
for key,actor in pairs(stages.actors) do for key,actor in pairs(stages.actors) do
if viewp:inside(actor.x, actor.y, actor.w, actor.h) and actor~=abad then if viewp:inside(actor.x, actor.y, actor.w, actor.h) and actor~=abad then
actor:draw() actor:draw()
@@ -260,22 +65,36 @@ function stages.stage1_draw_back()
end end
end end
function stages.stage1_draw_middle() function stages.stage2_draw_middle()
-- print("stage1_draw_middle")
end end
function stages.stage1_draw_front() function stages.stage2_draw_front()
-- print("stage1_draw_front")
-- fireball.draw()
-- boss_meter:draw()
end end
function stages.stage2_init() function stages.stage2_bg_music()
-- print("stage 2 init") music_player:play(audio_song_premiere)
end end
-- require "stage1_maps" function stages.stage2_viewport_update()
require "stage1_world_map" -- Moure el viewport
require "stage1_boss_map" local vp_x = viewp.x
require "stage1_boss" local vp_y = viewp.y
require "stage1_ending"
local vp_center_offset_x = (viewp.width // 2)
local vp_center_offset_y = (viewp.height // 2)
vp_x = abad.x+(abad.w/2) - vp_center_offset_x
if vp_x < 0 then vp_x = 0 end
vp_y = abad.y - vp_center_offset_y
if vp_y < 0 then vp_y = 0 end
viewp:position(vp_x, vp_y)
end
require "stage2_world_map"
require "stage2_boss_map"
require "stage2_boss"
require "stage2_ending"
+2 -1
View File
@@ -48,7 +48,8 @@ function stage2_ending:update_scene()
-- copter.init() -- copter.init()
copter.y=copter.y-16 copter.y=copter.y-16
table.insert( actors, copter) table.insert( actors, copter)
music.play(audio_song_copter) -- music.play(audio_song_copter)
music_player:play(audio_song_copter)
elseif self.time<720 then elseif self.time<720 then
-- sisena escena - premiere copter -- sisena escena - premiere copter
premiere.update() premiere.update()
+176
View File
@@ -1,3 +1,44 @@
s02_mapa_room_cols = 12; -- en quantitat de tiles
s02_mapa_room_rows = 6; -- en quantitat de tiles
s02_mapa_rooms_per_piso = 16
s02_mapa_pisos = 1
mapa_empty_tile = 256
-- Nuvols
-- 3x4
-- . 8 9 .
-- 5 6 6 7
-- 1 2 3 4
--
-- . 5 9 .
-- 8 1 7 7
-- 1 4 4 4
--
-- 3x3
-- . 8 9
-- 5 7 3
-- 1 4 .
--
-- 4x2
-- 10 11 12 13
-- 1 2 3 4
--
-- 2x2
-- 10 13
-- 1 4
--
-- 5 7
-- 1 4
--
-- 8 9
-- 1 4
--
-- 8 7
-- 1 4
--
-- 10 13
-- 2 3
stage2_mapa={ stage2_mapa={
-- 1 -- 1
{ {
@@ -8,4 +49,139 @@ stage2_mapa={
256,256,256,256,256,256,256,256,256,256,256,256, 256,256,256,256,256,256,256,256,256,256,256,256,
256,256,256,256,256,256,256,256,256,256,256,256, 256,256,256,256,256,256,256,256,256,256,256,256,
}, },
-- 1
{
256,256,256,256,256,256,256,256,256,256,256,256,
256,256,256,256,256,256,256,256,256,256,256,256,
256,256,256,256,256,256,256,256,256,256,256,256,
256,256,256,256,256,256,256,256,256,256,256,256,
256,256,256,256,256,256,256,256,256,256,256,256,
256,256,256,256,256,256,256,256,256,256,256,256,
},
-- 1
{
256,256,256,256,256,256,256,256,256,256,256,256,
256,256,256,256,256,256,256,256,256,256,256,256,
256,256,256,256,256,256,256,256,256,256,256,256,
256,256,256,256,256,256,256,256,256,256,256,256,
256,256,256,256,256,256,256,256,256,256,256,256,
256,256,256,256,256,256,256,256,256,256,256,256,
},
-- 1
{
256,256,256,256,256,256,256,256,256,256,256,256,
256,256,256,256,256,256,256,256,256,256,256,256,
256,256,256,256,256,256,256,256,256,256,256,256,
256,256,256,256,256,256,256,256,256,256,256,256,
256,256,256,256,256,256,256,256,256,256,256,256,
256,256,256,256,256,256,256,256,256,256,256,256,
},
-- 1
{
256,256,256,256,256,256,256,256,256,256,256,256,
256,256,256,256,256,256,256,256,256,256,256,256,
256,256,256,256,256,256,256,256,256,256,256,256,
256,256,256,256,256,256,256,256,256,256,256,256,
256,256,256,256,256,256,256,256,256,256,256,256,
256,256,256,256,256,256,256,256,256,256,256,256,
},
-- 1
{
256,256,256,256,256,256,256,256,256,256,256,256,
256,256,256,256,256,256,256,256,256,256,256,256,
256,256,256,256,256,256,256,256,256,256,256,256,
256,256,256,256,256,256,256,256,256,256,256,256,
256,256,256,256,256,256,256,256,256,256,256,256,
256,256,256,256,256,256,256,256,256,256,256,256,
},
-- 1
{
256,256,256,256,256,256,256,256,256,256,256,256,
256,256,256,256,256,256,256,256,256,256,256,256,
256,256,256,256,256,256,256,256,256,256,256,256,
256,256,256,256,256,256,256,256,256,256,256,256,
256,256,256,256,256,256,256,256,256,256,256,256,
256,256,256,256,256,256,256,256,256,256,256,256,
},
-- 1
{
256,256,256,256,256,256,256,256,256,256,256,256,
256,256,256,256,256,256,256,256,256,256,256,256,
256,256,256,256,256,256,256,256,256,256,256,256,
256,256,256,256,256,256,256,256,256,256,256,256,
256,256,256,256,256,256,256,256,256,256,256,256,
256,256,256,256,256,256,256,256,256,256,256,256,
},
-- 1
{
256,256,256,256,256,256,256,256,256,256,256,256,
256,256,256,256,256,256,256,256,256,256,256,256,
256,256,256,256,256,256,256,256,256,256,256,256,
256,256,256,256,256,256,256,256,256,256,256,256,
256,256,256,256,256,256,256,256,256,256,256,256,
256,256,256,256,256,256,256,256,256,256,256,256,
},
-- 1
{
256,256,256,256,256,256,256,256,256,256,256,256,
256,256,256,256,256,256,256,256,256,256,256,256,
256,256,256,256,256,256,256,256,256,256,256,256,
256,256,256,256,256,256,256,256,256,256,256,256,
256,256,256,256,256,256,256,256,256,256,256,256,
256,256,256,256,256,256,256,256,256,256,256,256,
},
-- 1
{
256,256,256,256,256,256,256,256,256,256,256,256,
256,256,256,256,256,256,256,256,256,256,256,256,
256,256,256,256,256,256,256,256,256,256,256,256,
256,256,256,256,256,256,256,256,256,256,256,256,
256,256,256,256,256,256,256,256,256,256,256,256,
256,256,256,256,256,256,256,256,256,256,256,256,
},
-- 1
{
256,256,256,256,256,256,256,256,256,256,256,256,
256,256,256,256,256,256,256,256,256,256,256,256,
256,256,256,256,256,256,256,256,256,256,256,256,
256,256,256,256,256,256,256,256,256,256,256,256,
256,256,256,256,256,256,256,256,256,256,256,256,
256,256,256,256,256,256,256,256,256,256,256,256,
},
-- 1
{
256,256,256,256,256,256,256,256,256,256,256,256,
256,256,256,256,256,256,256,256,256,256,256,256,
256,256,256,256,256,256,256,256,256,256,256,256,
256,256,256,256,256,256,256,256,256,256,256,256,
256,256,256,256,256,256,256,256,256,256,256,256,
256,256,256,256,256,256,256,256,256,256,256,256,
},
-- 1
{
256,256,256,256,256,256,256,256,256,256,256,256,
256,256,256,256,256,256,256,256,256,256,256,256,
256,256,256,256,256,256,256,256,256,256,256,256,
256,256,256,256,256,256,256,256,256,256,256,256,
256,256,256,256,256,256,256,256,256,256,256,256,
256,256,256,256,256,256,256,256,256,256,256,256,
},
-- 1
{
256,256,256,256,256,256,256,256,256,256,256,256,
256,256,256,256,256,256,256,256,256,256,256,256,
256,256,256,256,256,256,256,256,256,256,256,256,
256,256,256,256,256,256,256,256,256,256,256,256,
256,256,256,256,256,256,256,256,256,256,256,256,
256,256,256,256,256,256,256,256,256,256,256,256,
},
-- 1
{
256,256,256,256,256,256,256,256,256,256,256,256,
256,256,256,256,256,256,256,256,256,256,256,256,
256,256,256,256,256,256,256,256,256,256,256,256,
256,256,256,256,256,256,256,256,256,256,256,256,
256,256,256,256,256,256,256,256,256,256,256,256,
256,256,256,256,256,256,256,256,256,256,256,256,
},
} }
+22 -13
View File
@@ -1,8 +1,8 @@
stages = {} stages = {}
stages.stage = 1 stages.stage = 2
stages.stage_loaded = 0 stages.stage_loaded = 0
stages.last_stage = 1 stages.last_stage = 2
stages.actors={} stages.actors={}
stages.boss_loaded = false stages.boss_loaded = false
@@ -15,14 +15,18 @@ stages.stage_update = nil
stages.stage_draw_back = nil stages.stage_draw_back = nil
stages.stage_draw_middle = nil stages.stage_draw_middle = nil
stages.stage_draw_front = nil stages.stage_draw_front = nil
stages.stage_bg_music = nil
function stages.load_stage( init ) function stages.load_stage( init )
print("Loading stage "..stages.stage)
init = init or false init = init or false
stages.stage_init = stages["stage"..stages.stage.."_init"] stages.stage_init = stages["stage"..stages.stage.."_init"]
stages.stage_update = stages["stage"..stages.stage.."_update"] stages.stage_update = stages["stage"..stages.stage.."_update"]
stages.stage_draw_back = stages["stage"..stages.stage.."_draw_back"] stages.stage_draw_back = stages["stage"..stages.stage.."_draw_back"]
stages.stage_draw_middle = stages["stage"..stages.stage.."_draw_middle"] stages.stage_draw_middle = stages["stage"..stages.stage.."_draw_middle"]
stages.stage_draw_front = stages["stage"..stages.stage.."_draw_front"] stages.stage_draw_front = stages["stage"..stages.stage.."_draw_front"]
stages.stage_bg_music = stages["stage"..stages.stage.."_bg_music"]
stages.stage_viewport_update = stages["stage"..stages.stage.."_viewport_update"]
stages.stage_loaded = stages.stage stages.stage_loaded = stages.stage
stages.boss_ready = false stages.boss_ready = false
stages.boss_loaded = false stages.boss_loaded = false
@@ -30,11 +34,13 @@ function stages.load_stage( init )
end end
function stages.load_boss_stage() function stages.load_boss_stage()
stages.stage_init = stages["stage"..stages.stage.."_boss_init"] stages.stage_init = stages["stage"..stages.stage.."_boss_init"]
stages.stage_update = stages["stage"..stages.stage.."_boss_update"] stages.stage_update = stages["stage"..stages.stage.."_boss_update"]
stages.stage_draw_back = stages["stage"..stages.stage.."_boss_draw_back"] stages.stage_draw_back = stages["stage"..stages.stage.."_boss_draw_back"]
stages.stage_draw_middle = stages["stage"..stages.stage.."_boss_draw_middle"] stages.stage_draw_middle = stages["stage"..stages.stage.."_boss_draw_middle"]
stages.stage_draw_front = stages["stage"..stages.stage.."_boss_draw_front"] stages.stage_draw_front = stages["stage"..stages.stage.."_boss_draw_front"]
stages.stage_bg_music = stages["stage"..stages.stage.."_boss_bg_music"]
stages.stage_viewport_update = stages["stage"..stages.stage.."_boss_viewport_update"]
stages.boss_loaded = true stages.boss_loaded = true
end end
@@ -52,4 +58,7 @@ function stages.next_stage()
else else
stages.load_stage(true) stages.load_stage(true)
end end
end end
require "stage1"
require "stage2"
+11 -30
View File
@@ -1,25 +1,3 @@
-- flow={
-- level=1,
-- step={0},
-- actiu="",
-- pila={},
-- paths={ {flow_safe} },
-- registre={}
-- -- sub_path_enable = false,
-- -- sub_step = 0,
-- -- sub_path={}
-- }
-- function flow:print()
-- print("> STEP= "..self.step.." / "..#self.path)
-- if self.sub_path_enable then
-- print("> SUB_PATH_ENABLE= TRUE")
-- else
-- print("> SUB_PATH_ENABLE= FALSE")
-- end
-- print("> SUB_STEP= "..self.sub_step.." / "..#self.sub_path)
-- print("")
-- end
states={ states={
registre={}, -- {nom {ptr (a l'estat actual), path (llista de funcions ordenada)} ...} registre={}, -- {nom {ptr (a l'estat actual), path (llista de funcions ordenada)} ...}
@@ -40,7 +18,8 @@ end
function states:registrar(nom, _path) function states:registrar(nom, _path)
print("[STATES] REGISTRAR => "..nom) print("[STATES] REGISTRAR => "..nom)
self.registre[nom]= {ptr=0, path=_path} self.registre[nom]= {ptr=0, path=_path}
print(self.registre[nom].ptr) -- print(" nom.ptr -> "..self.registre[nom].ptr)
-- print(" nom.path -> "..#self.registre[nom].path)
end end
function states:borrar(nom) function states:borrar(nom)
@@ -68,22 +47,24 @@ function states:executar(nom, stacking)
end end
self.actiu=nom self.actiu=nom
self.registre[self.actiu].ptr=0 self.registre[self.actiu].ptr=0
-- Executar el primer pas
self:next() self:next()
end end
function states:next() function states:next()
print("[STATES] NEXT "..self.actiu); -- print("[STATES] NEXT "..self.actiu);
local ptr = self.registre[self.actiu].ptr local estat = self.registre[self.actiu]
local steps = #self.registre[self.actiu].path local ptr = estat.ptr
-- print("STATES_NEXT= "..self.actiu..", "..ptr..", "..steps) local steps = #estat.path
if ptr+1>steps then if ptr+1>steps then
self:finish() self:finish()
else else
self.registre[self.actiu].ptr = ptr+1 estat.ptr = ptr+1
game_update = self.registre[self.actiu].path[self.registre[self.actiu].ptr] -- print("[STATES] NEXT "..self.actiu.." ("..estat.ptr.." / "..steps..")")
game_update = estat.path[estat.ptr]
end end
return self.actiu, self.registre[self.actiu].ptr return self.actiu, estat.ptr
end end
function states:finish() function states:finish()
BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

+2 -1
View File
@@ -32,7 +32,8 @@ local rect_wait = 0
function title_init() function title_init()
title_sf=surf.load("title_tiles.gif") title_sf=surf.load("title_tiles.gif")
surf.source(title_sf) surf.source(title_sf)
music.play(audio_main_song) -- music.play(audio_main_song)
music_player:play(audio_main_song)
states:next() states:next()
end end
+11
View File
@@ -87,6 +87,17 @@ function triggers:open_door()
end end
end end
function triggers:add_1up()
local x, y = coords.room_to_world(38, 8, 1)
table.insert( actors, one_up.new(38, x, y, 1, 0, true) )
triggers.open_door(self)
end
function triggers:start_bg_music()
stages.stage_bg_music()
remove_actor(self)
end
function triggers:escena_abad_inici() function triggers:escena_abad_inici()
start_scene(scenes.abad_inici) start_scene(scenes.abad_inici)
remove_actor(self) remove_actor(self)
+1 -1
View File
@@ -1,4 +1,4 @@
require "map" -- require "map"
viewport={} viewport={}
+59
View File
@@ -99,3 +99,62 @@ function warp.update_all()
end end
end end
function actor_warp_draw(actor)
local shrink_w = actor.w*actor.shrink
local shrink_h = actor.h*actor.shrink
local offset_x = math.floor((actor.w-shrink_w)/2)
local offset_y = math.floor((actor.h-shrink_h)/2)
local scr_x, scr_y = viewp:screen_coords( actor.x+offset_x, actor.y+offset_y )
shrink_w = math.floor(shrink_w)
shrink_h = math.floor(shrink_h)
if shrink_w>0 and shrink_h>0 then
draw.surfrot((actor.frame&7)*cw, (actor.frame>>cxr2)*ch,
cw, ch,
scr_x, scr_y,
actor.angle,
shrink_w, shrink_h,
actor.flip)
end
end
function actor_warp_update(actor)
-- warp, wait, respawn
if actor.warping then
if actor.step<actor.death_time then
actor.shrink=actor.shrink-actor.d_shrink
actor.angle=actor.angle+actor.d_angle
if actor.angle>=360 then actor.angle = actor.angle % 360 end
if actor.shrink<=0 then
actor.shrink=1
actor.d_shrink=1
actor.angle=0
actor.d_angle=1
actor.warping = false
actor.frame = -1
actor.step = 0
if actor.energy~=nil then
actor.energy = actor.max_energy
end
end
end
elseif actor.step<actor.death_time/2 then
actor.frame = -1
elseif actor.step<actor.death_time then
if actor.step%2==0 then
actor.frame=actor.anim[#actor.anim]
else
actor.frame=-1
end
elseif actor.step>=actor.death_time then
actor.frame=actor.anim[1]
actor.step=0
actor.wait=0
if actor.name=="caco" then
actor.update=caco.update_normal
elseif actor.name=="zombie" then
actor.update=zombie.update_normal
end
actor.dying = false
end
end