Files
cacaus/trigger.lua
JailDoctor 3d9cbaef3d - segon teleport
- tecles debug llevades
2023-01-13 14:23:28 +01:00

109 lines
2.3 KiB
Lua

trigger={}
function trigger.new(_hab,_x,_y,_fun)
return {hab=_hab,x=_x,y=_y,fun=_fun,update=trigger.update,draw=trigger.draw,bb={x=0,y=0,w=8,h=8}}
end
function trigger:draw()
-- do nothing
--rectfill(self.x,self.y,self.x+8,self.y+8,3)
end
function trigger:update()
if self.hab==abad.hab then
if aabb(abad,self) then
self:fun()
end
end
end
--function trigger:do_touched()
-- start_scene(self.scene)
-- remove_actor(self)
--end
triggers={}
function triggers:escena_abad_inici()
start_scene(scenes.abad_inici)
remove_actor(self)
end
function triggers:escena_abad_corfes()
start_scene(scenes.abad_corfes)
remove_actor(self)
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
start_scene(scenes.abad_portes)
end
abad.escena_portes=true
remove_actor(self)
end
function triggers:escena_abad_porta_casa()
if mapa_get_tile(abad.hab,6,4)~=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
start_scene(scenes.abad_porta_batman)
end
remove_actor(self)
end
function triggers:escena_habitacio_batman()
if abad.objects.clau_premiere~=nil and abad.objects.clau_elalien~=nil then
switches.start(0,0)
abad.objects.clau_premiere=nil
abad.objects.clau_elalien=nil
remove_actor(self)
else
if batman.habitacio_porta_intro==nil then
start_scene(scenes.habitacio_batman)
batman.habitacio_porta_intro=true
end
end
end
function triggers:teleport_a()
abad.teleport=true
playsnd(audio_hit)
cls(14)
imp.reset()
abad.hab=67
abad.x=24
end
function triggers:teleport_b()
if abad.teleport then
playsnd(audio_hit)
cls(14)
imp.reset()
abad.hab=14
abad.x=16
end
end
function triggers:teleport_c()
abad.teleport2=true
playsnd(audio_hit)
cls(14)
imp.reset()
abad.hab=61
abad.x=24
end
function triggers:teleport_d()
if abad.teleport2 then
playsnd(audio_hit)
cls(14)
imp.reset()
abad.hab=29
abad.x=24
end
end