[WIP] Stage 2

This commit is contained in:
2026-05-25 22:08:22 +02:00
parent a29dea89ae
commit 2eb4bc82eb
2 changed files with 160 additions and 233 deletions
+19 -233
View File
@@ -6,196 +6,23 @@ stages.boss_ready = false
stages.boss_finished = false
boss = nil
function stages.stage1_init()
function stages.stage2_init()
stages.actors={}
mapa = stage1_mapa
actors={}
mapa = stage2_mapa
tiletype={void=0,nonpc=1,stair=2,switch=3,half=4,block=5}
mapa.wait=0
mapa.step=0
mapa.tobatcave = false
surf.free(sf_mapa)
sf_mapa=surf.new(s2_mapa_room_cols*s2_mapa_rooms_per_piso,s2_mapa_room_rows*s2_mapa_pisos)
load_tilemap( sf_mapa )
llibre.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()
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,batvio)
table.insert( actors, trigger.new(31,1,3,triggers.escena_abad_portes,"portes","TR03") )
table.insert( actors, trigger.new(31,6,3,triggers.escena_abad_portes,"portes","TR04") )
table.insert( actors, trigger.new(71,7,3,triggers.escena_abad_portes,"portes","TR05") )
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 )
local abad_x, abad_y = coords.room_to_world ( 1, 4, 3 )
abad:move(abad_x, abad_y)
abad_make_safe( true )
@@ -210,40 +37,7 @@ function stages.stage1_init()
stages.boss_loaded = false
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()
-- print("stage1_update")
-- fireball.update()
-- if (abad.energia<=abad.max_energia/2) then
-- -- Requeriment: tindre mitja clau
-- premiere.healer_init()
-- end
stages.stage1_toBatcave()
function stages.stage2_update()
for key,actor in pairs(stages.actors) do
if viewp:inside(actor.x, actor.y, actor.w, actor.h) and actor~=abad then
actor:update()
@@ -251,8 +45,7 @@ function stages.stage1_update()
end
end
function stages.stage1_draw_back()
-- print("stage1_draw_back")
function stages.stage2_draw_back()
for key,actor in pairs(stages.actors) do
if viewp:inside(actor.x, actor.y, actor.w, actor.h) and actor~=abad then
actor:draw()
@@ -260,22 +53,15 @@ function stages.stage1_draw_back()
end
end
function stages.stage1_draw_middle()
-- print("stage1_draw_middle")
function stages.stage2_draw_middle()
end
function stages.stage1_draw_front()
-- print("stage1_draw_front")
-- fireball.draw()
-- boss_meter:draw()
function stages.stage2_draw_front()
end
function stages.stage2_init()
-- print("stage 2 init")
end
-- require "stage1_maps"
require "stage1_world_map"
require "stage1_boss_map"
require "stage1_boss"
require "stage1_ending"
require "stage2_world_map"
require "stage2_boss_map"
require "stage2_boss"
require "stage2_ending"
+141
View File
@@ -1,3 +1,9 @@
s2_mapa_room_cols = 12; -- en quantitat de tiles
s2_mapa_room_rows = 6; -- en quantitat de tiles
s2_mapa_rooms_per_piso = 16
s2_mapa_pisos = 1
mapa_empty_tile = 256
stage2_mapa={
-- 1
{
@@ -8,4 +14,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,
},
-- 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,
},
}