Triggers en marxa

This commit is contained in:
2026-04-03 21:37:39 +02:00
parent 8b516a6a26
commit 5a385ef1a8
2 changed files with 65 additions and 99 deletions

View File

@@ -1,9 +1,10 @@
trigger={}
function trigger.new(_hab,_x,_y,_fun)
function trigger.new(_hab,_x,_y,_fun,_escena)
local world_x, world_y = coords.room_to_world(_hab,_x,_y)
return {
name="trigger",
escena=_escena,
hab=_hab,
x=world_x,
y=world_y,
@@ -46,7 +47,11 @@ function triggers:escena_abad_corfes()
end
function triggers:escena_abad_portes()
if abad.escena_portes==nil and ((abad.hab==31 and mapa_get_tile(abad.hab,2,4)~=256) or (abad.hab==71 and mapa_get_tile(abad.hab,6,3)~=256)) then
local wx1,wy1 = coords.room_to_world(abad.hab,2,4)
local wx2,wy2 = coords.room_to_world(abad.hab,6,3)
if abad.escena_portes==nil
and ( (abad.hab==31 and arc_get_tile(wx1,wy1)~=256)
or (abad.hab==71 and arc_get_tile(wx2,wy2)~=256) ) then
start_scene(scenes.abad_portes)
end
abad.escena_portes=true
@@ -54,14 +59,16 @@ function triggers:escena_abad_portes()
end
function triggers:escena_abad_porta_casa()
if mapa_get_tile(abad.hab,6,4)~=256 then
local wx1,wy1 = coords.room_to_world(abad.hab,6,4)
if arc_get_tile(wx1,wy1)~=256 then
start_scene(scenes.abad_porta_casa)
end
remove_actor(self)
end
function triggers:escena_abad_porta_batman()
if mapa_get_tile(abad.hab,5,4)~=256 then
local wx1,wy1 = coords.room_to_world(abad.hab,5,4)
if arc_get_tile(wx1,wy1)~=256 then
start_scene(scenes.abad_porta_batman)
end
remove_actor(self)
@@ -81,40 +88,40 @@ function triggers:escena_habitacio_batman()
end
end
function triggers:teleport_a()
abad.teleport=true
sound.play(audio_hit)
surf.cls(14)
imp.reset()
abad.hab=67
abad.x=24
end
function triggers:teleport_b()
if abad.teleport then
sound.play(audio_hit)
surf.cls(14)
imp.reset()
abad.hab=14
abad.x=16
end
end
function triggers:teleport_c()
abad.teleport2=true
sound.play(audio_hit)
surf.cls(14)
imp.reset()
abad.hab=61
abad.x=24
end
function triggers:teleport_d()
if abad.teleport2 then
sound.play(audio_hit)
surf.cls(14)
imp.reset()
abad.hab=29
abad.x=24
end
end
-- function triggers:teleport_a()
-- abad.teleport=true
-- sound.play(audio_hit)
-- surf.cls(14)
-- imp.reset()
-- abad.hab=67
-- abad.x=24
-- end
--
-- function triggers:teleport_b()
-- if abad.teleport then
-- sound.play(audio_hit)
-- surf.cls(14)
-- imp.reset()
-- abad.hab=14
-- abad.x=16
-- end
-- end
--
-- function triggers:teleport_c()
-- abad.teleport2=true
-- sound.play(audio_hit)
-- surf.cls(14)
-- imp.reset()
-- abad.hab=61
-- abad.x=24
-- end
--
-- function triggers:teleport_d()
-- if abad.teleport2 then
-- sound.play(audio_hit)
-- surf.cls(14)
-- imp.reset()
-- abad.hab=29
-- abad.x=24
-- end
-- end