[WIP] Reestructurant codi abans de posar-me en el nivell 2
[NEW] Afegit music_player [NEW] Música de fons des de l'inici
This commit is contained in:
+62
-47
@@ -1,14 +1,40 @@
|
||||
|
||||
function stages.stage1_init()
|
||||
-- stagemgr init
|
||||
stages.actors={}
|
||||
stages.boss_loaded = false
|
||||
stages.boss_ready = false
|
||||
stages.boss_finished = false
|
||||
boss = nil
|
||||
-- actors={}
|
||||
|
||||
-- mapa init
|
||||
mapa = stage1_mapa
|
||||
print("mapa loaded")
|
||||
|
||||
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}
|
||||
mapa.wait=0
|
||||
mapa.step=0
|
||||
mapa.tobatcave = false
|
||||
mapa_surface_init()
|
||||
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()
|
||||
table.insert(actors,llibre)
|
||||
|
||||
@@ -31,8 +57,6 @@ function stages.stage1_init()
|
||||
table.insert( actors, boss )
|
||||
boss_meter = bar_meter.new(20,12,128,10,1,1,boss,5)
|
||||
|
||||
--batman
|
||||
|
||||
bol.init()
|
||||
table.insert(actors,bol)
|
||||
|
||||
@@ -104,10 +128,10 @@ function stages.stage1_init()
|
||||
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(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(31,1,3,triggers.escena_abad_portes,"portes","TR03") )
|
||||
@@ -129,18 +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,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(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 (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))
|
||||
|
||||
-- Dialegs
|
||||
trigger_event.new("Premiere dialeg 1",
|
||||
trigger_ev.dialeg_trigger,
|
||||
trigger_ev.dialeg_init,
|
||||
@@ -185,49 +202,17 @@ 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(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
|
||||
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 )
|
||||
|
||||
-- local abad_x, abad_y = coords.room_to_world ( 8, 9, 3 )
|
||||
abad:move(abad_x, abad_y)
|
||||
abad_make_safe( true )
|
||||
|
||||
local scr_ax, scr_ay = viewp:screen_coords(abad_x, abad_y)
|
||||
|
||||
remote_view_init()
|
||||
|
||||
viewp:free_move()
|
||||
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()
|
||||
stages.stage1_toBatcave()
|
||||
for key,actor in pairs(stages.actors) do
|
||||
@@ -256,6 +241,36 @@ function stages.stage1_draw_front()
|
||||
-- boss_meter:draw()
|
||||
end
|
||||
|
||||
function stages.stage1_bg_music()
|
||||
music_player:play(audio_song_premiere)
|
||||
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_boss_map"
|
||||
require "stage1_boss"
|
||||
|
||||
Reference in New Issue
Block a user