[FIX] Canviat el nom de flow a states que es mes precis

[FIX] Ajustada posició del peu en habitació 27
[FIX] Modificat trigger_event per a que es disparen en una habitació concreta i també segons distancia sense haver de colisionar
[FIX] Ending stage 1
[FIX] ELiminades llunes duplicades
[NEW] Dialeg per a l'abad
This commit is contained in:
2026-05-10 14:08:11 +02:00
parent 8657dfd918
commit 45ea1b33bf
16 changed files with 105 additions and 80 deletions
+5 -2
View File
@@ -26,9 +26,8 @@ batvio={
d_angle=15, d_angle=15,
dying=false, dying=false,
death_time=40, death_time=40,
enabled=true, enabled=false,
disable_reason="", disable_reason="",
enabled=true,
} }
function batvio.init() function batvio.init()
@@ -38,6 +37,8 @@ function batvio.init()
end end
function batvio.draw() function batvio.draw()
if not batvio.enabled then return end
local curr_sf = surf.source() local curr_sf = surf.source()
surf.source(tiles2) surf.source(tiles2)
local scr_x, scr_y = viewp:screen_coords( batvio.x, batvio.y ) local scr_x, scr_y = viewp:screen_coords( batvio.x, batvio.y )
@@ -66,5 +67,7 @@ function batvio.hit()
end end
function batvio.update() function batvio.update()
if not batvio.enabled then return end
batvio.step = batvio.step +1 batvio.step = batvio.step +1
end end
+1
View File
@@ -67,6 +67,7 @@ function bol.update()
remove_actor(bol) remove_actor(bol)
-- crear el trigger per a disparar el final de fase -- crear el trigger per a disparar el final de fase
table.insert( actors, trigger.new(8,4,3,triggers.escena_stage1_ending,"stage1 ending","TR09") ) table.insert( actors, trigger.new(8,4,3,triggers.escena_stage1_ending,"stage1 ending","TR09") )
batvio.enabled = true
end end
end end
end end
+2 -2
View File
@@ -130,7 +130,7 @@ function game_init(menu)
score.create() score.create()
-- game_update=update_game -- game_update=update_game
flow:next() states:next()
end end
@@ -521,4 +521,4 @@ function debug_info()
font.current(font_sf) font.current(font_sf)
end end
flow:registrar("game", {game_init, update_game} ) states:registrar("game", {game_init, update_game} )
+4 -4
View File
@@ -47,13 +47,13 @@ print("INTRO_INIT")
fade.fadein() fade.fadein()
font.current(font_sf) font.current(font_sf)
-- flow:add_path({intro_intro, intro_update}) -- flow:add_path({intro_intro, intro_update})
flow:next() states:next()
end end
function intro_intro() function intro_intro()
intro_wait=1 intro_wait=1
-- game_update = intro_update -- game_update = intro_update
flow:next() states:next()
fade.fadeoutin() fade.fadeoutin()
end end
@@ -135,7 +135,7 @@ end
function intro_end() function intro_end()
print("intro_end") print("intro_end")
fade.fadeoutin() fade.fadeoutin()
flow:executar("title") states:executar("title")
end end
flow:registrar("intro", {intro_init, intro_intro, intro_update}) states:registrar("intro", {intro_init, intro_intro, intro_update})
+4 -4
View File
@@ -49,7 +49,7 @@ function logo_init()
-- Següent bucle -- Següent bucle
-- game_update = logo_intro -- game_update = logo_intro
local modul, pas=flow:next() local modul, pas=states:next()
print("LOGO_INIT= "..modul..", "..pas) print("LOGO_INIT= "..modul..", "..pas)
end end
@@ -175,7 +175,7 @@ function logo_end()
-- print("LOGO_END") -- print("LOGO_END")
-- game_update = intro_init -- game_update = intro_init
print("logo_end") print("logo_end")
flow:executar("intro") states:executar("intro")
-- surf.free(logo_sf) -- surf.free(logo_sf)
end end
@@ -185,7 +185,7 @@ function logo_animate()
-- Següent bucle -- Següent bucle
if logo_step==7 or controller:check("ESC") or controller:check("shoot") then if logo_step==7 or controller:check("ESC") or controller:check("shoot") then
local modul, pas=flow:next() local modul, pas=states:next()
-- print("LOGO_ANIMATE 1= "..modul..", "..pas) -- print("LOGO_ANIMATE 1= "..modul..", "..pas)
end end
@@ -193,4 +193,4 @@ function logo_animate()
logo_update() logo_update()
end end
flow:registrar("logo",{logo_init, logo_animate, logo_end}) states:registrar("logo",{logo_init, logo_animate, logo_end})
+2 -2
View File
@@ -2,7 +2,7 @@ arcade_config = require("arcade_config")
coords = require "coords" coords = require "coords"
require "helpers" require "helpers"
require "controller" require "controller"
require "flow" require "states"
require "map" require "map"
require "mapa" require "mapa"
@@ -88,7 +88,7 @@ function mini.init()
logo_config(font_sf) logo_config(font_sf)
surf.target(0) surf.target(0)
surf.cls(16) surf.cls(16)
flow:executar("game") states:executar("logo")
end end
function mini.update() function mini.update()
+7 -7
View File
@@ -2,7 +2,7 @@ local menu_sel = 0
function opcions_init() function opcions_init()
-- flow:add_path({opcions_show, opcions_end}) -- flow:add_path({opcions_show, opcions_end})
flow:next() states:next()
end end
function opcions_draw() function opcions_draw()
@@ -27,14 +27,14 @@ function opcions_update()
elseif menu_sel==2 then elseif menu_sel==2 then
-- menu_count=0 -- menu_count=0
-- menu_state=update_redefine_keys_menu -- menu_state=update_redefine_keys_menu
flow:executar("opcions_teclat", true) states:executar("opcions_teclat", true)
elseif menu_sel==3 then elseif menu_sel==3 then
-- menu_count=0 -- menu_count=0
-- menu_state=update_redefine_pad_menu -- menu_state=update_redefine_pad_menu
flow:executar("opcions_gamepad", true) states:executar("opcions_gamepad", true)
else else
-- Tornar -- Tornar
flow:next() states:next()
end end
elseif key.press(keyDown) or key.press(key.DOWN) or pad.press(pad.DOWN) or pad.press(btnDown) then elseif key.press(keyDown) or key.press(key.DOWN) or pad.press(pad.DOWN) or pad.press(btnDown) then
menu_sel=menu_sel+1 menu_sel=menu_sel+1
@@ -44,7 +44,7 @@ function opcions_update()
if menu_sel==-1 then menu_sel=4 end if menu_sel==-1 then menu_sel=4 end
elseif key.press(key.ESCAPE) or pad.press(btnPause) then elseif key.press(key.ESCAPE) or pad.press(btnPause) then
-- Tornar desde qualsevol lloc -- Tornar desde qualsevol lloc
flow:next() states:next()
end end
end end
@@ -56,7 +56,7 @@ end
function opcions_end() function opcions_end()
print("opcions_end") print("opcions_end")
-- flow:restore() -- flow:restore()
flow:finish() states:finish()
end end
flow:registrar("opcions",{opcions_init, opcions_show, opcions_end}) states:registrar("opcions",{opcions_init, opcions_show, opcions_end})
+6 -6
View File
@@ -20,7 +20,7 @@ function opcions_input_init()
surf.target(0) surf.target(0)
surf.cls(16) surf.cls(16)
menu_opt = 1 menu_opt = 1
flow:next() states:next()
end end
function opcions_input_draw() function opcions_input_draw()
@@ -70,7 +70,7 @@ function opcions_input_update()
local curr_key = input_keys[menu_opt] local curr_key = input_keys[menu_opt]
if key.press(key.ESCAPE) then if key.press(key.ESCAPE) then
flow:next() states:next()
return return
end end
@@ -99,7 +99,7 @@ end
function opcions_input_end() function opcions_input_end()
menu_opt = 0 menu_opt = 0
flow:finish() states:finish()
end end
function config_key(def_key, k) function config_key(def_key, k)
@@ -120,8 +120,8 @@ function config_key(def_key, k)
print("ERROR AL DEFINIR") print("ERROR AL DEFINIR")
end end
if end_setup then flow:next() end if end_setup then states:next() end
end end
flow:registrar("opcions_teclat", { opcions_teclat_init, opcions_input_show, opcions_input_end } ) states:registrar("opcions_teclat", { opcions_teclat_init, opcions_input_show, opcions_input_end } )
flow:registrar("opcions_gamepad", { opcions_gamepad_init, opcions_input_show, opcions_input_end } ) states:registrar("opcions_gamepad", { opcions_gamepad_init, opcions_input_show, opcions_input_end } )
+1 -1
View File
@@ -11,7 +11,7 @@ peu={name="peu",hab=5,x=6,y=3,w=32,h=32,bb={x=0,y=0,w=16,h=16}}
function peu.init() function peu.init()
-- local habs={{18,8},{16,2},{16,7},{15,5},{27,1},{27,10},{29,2},{38,8},{69,2},{79,3}} -- local habs={{18,8},{16,2},{16,7},{15,5},{27,1},{27,10},{29,2},{38,8},{69,2},{79,3}}
local habs={{69,0},{78,6},{59,8},{27,8},{16,0},{18,8}} local habs={{69,0},{78,6},{59,8},{27,9},{16,0},{18,8}}
local r=1+math.random(0,#habs-1) local r=1+math.random(0,#habs-1)
peu.hab=habs[r][1] peu.hab=habs[r][1]
-- peu.x=habs[r][2]*8 -- peu.x=habs[r][2]*8
+6 -6
View File
@@ -214,7 +214,7 @@ function start_scene(_scene, offset, stop_music)
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")
flow:executar("scene", true); -- guardar l'estat anterior i executar states:executar("scene", true); -- guardar l'estat anterior i executar
end end
function playtext(snd) function playtext(snd)
@@ -399,7 +399,7 @@ function update_scene()
-- else -- else
-- game_update=old_update -- game_update=old_update
-- flow:restore() -- flow:restore()
flow:next() states:next()
-- end -- end
else else
next_scene() next_scene()
@@ -420,7 +420,7 @@ function update_scene()
-- game_init(true) -- game_init(true)
-- flow:next() -- flow:next()
-- game_update = menu_init -- game_update = menu_init
flow:executar("title") states:executar("title")
else else
pause() pause()
end end
@@ -437,7 +437,7 @@ function update_scene()
-- fade.fadeoutin() -- fade.fadeoutin()
-- else -- else
-- game_update=old_update -- game_update=old_update
flow:next() states:next()
-- end -- end
else else
-- scenes.dnum=scenes.dnum+1 -- scenes.dnum=scenes.dnum+1
@@ -452,7 +452,7 @@ end
function end_scene() function end_scene()
scene.running = false scene.running = false
flow:finish() states:finish()
end end
flow:registrar("scene",{update_scene, end_scene}) states:registrar("scene",{update_scene, end_scene})
+20 -10
View File
@@ -141,25 +141,31 @@ function stages.stage1_init()
trigger_ev.dialeg_trigger, trigger_ev.dialeg_trigger,
trigger_ev.dialeg_init, trigger_ev.dialeg_init,
nil, nil,
premiere, abad, 150, "Ma que cosa fare", 150) premiere, abad, 150, "Ma que cosa fare", 150, 0, true)
trigger_event.new("Zombie 1 dialeg", trigger_event.new("Zombie 1 dialeg",
trigger_ev.dialeg_trigger, trigger_ev.dialeg_trigger,
trigger_ev.dialeg_init, trigger_ev.dialeg_init,
nil, nil,
zombie1, abad, 150, "Sereeeeebrooooosssss", 250) zombie1, abad, 150, "Sereeeeebrooooosssss", 250, nil, true)
trigger_event.new("Zombie 2 dialeg", trigger_event.new("Zombie 2 dialeg",
trigger_ev.dialeg_trigger, trigger_ev.dialeg_trigger,
trigger_ev.dialeg_init, trigger_ev.dialeg_init,
nil, nil,
zombie2, abad, 150, "Aaaaaargh... per ell!", 250) zombie2, abad, 150, "Aaaaaargh... per ell!", 250, nil, true)
trigger_event.new("Elalien dialeg", trigger_event.new("Elalien dialeg",
trigger_ev.dialeg_trigger, trigger_ev.dialeg_trigger,
trigger_ev.dialeg_init, trigger_ev.dialeg_init,
nil, nil,
elalien, abad, 150, "I les tisores de podar?", 250) 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,3,144,144,16,16)
tiles_layer2.new(13,11,4,144,144,16,16) tiles_layer2.new(13,11,4,144,144,16,16)
@@ -169,8 +175,8 @@ function stages.stage1_init()
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") ) -- 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 )
@@ -253,7 +259,8 @@ stage1_mapa={
-- 1 -- 1
{ {
256,256,256,18,19,21,20,21,20,21,20,21, 256,256,256,18,19,21,20,21,20,21,20,21,
64,68,256,16,72,256,256,256,256,256,256,256, -- 64,68,256,16,72,256,256,256,256,256,256,256,
64,256,256,16,72,256,256,256,256,256,256,256,
256,256,66,256,88,256,256,70,71,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, 256,66,256,16,256,112,256,86,87,256,114,256,
66,256,256,16,256,256,256,256,256,256,256,256, 66,256,256,16,256,256,256,256,256,256,256,256,
@@ -313,7 +320,8 @@ stage1_mapa={
-- 7 -- 7
{ {
42,43,256,256,256,256,65,256,256,256,256,64, 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,67,256,256,256,256,68,256,256,256,
256,41,256,67,256,256,256,256,256,256,256,256,
256,41,256,256,256,66,256,256,256,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,64,256,256,65,256,67,256,67,256,
256,256,256,256,256,256,256,256,256,256,256,256, 256,256,256,256,256,256,256,256,256,256,256,256,
@@ -810,7 +818,8 @@ stage1_mapa={
-- 54 -- 54
{ {
20,21,20,21,21,17,18,19,67,256,256,256, 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,17,18,19,256,65,68,64,
256,256,256,256,256,17,18,19,256,65,256,64,
256,256,256,256,256,256,18,19,256,256,256,256, 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,67,256,64,256,
256,256,256,256,256,256,38,256,256,256,256,256, 256,256,256,256,256,256,38,256,256,256,256,256,
@@ -830,7 +839,8 @@ stage1_mapa={
-- 56 -- 56
{ {
65,256,256,256,67,256,67,256,256,256,256,64, 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,64,256,256,256,256,65,68,64,256,256,
256,256,64,256,256,256,256,65,256,64,256,256,
256,256,256,256,256,64,256,256,256,256,67,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,65,67,256,256,64,256,256,64,256,256,256,
256,256,256,256,256,256,256,256,256,256,256,256, 256,256,256,256,256,256,256,256,256,256,256,256,
+7 -4
View File
@@ -47,12 +47,15 @@ function stage1_ending.update_scene(self)
table.insert( actors, copter) table.insert( actors, copter)
music.play(audio_song_copter) music.play(audio_song_copter)
elseif self.time<720 then elseif self.time<720 then
-- sisena escena - premiere copter
premiere.update() premiere.update()
copter.x = premiere.x-32 copter.x = premiere.x-32
copter.y = premiere.y-48 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)
elseif self.time==721 then
fade.fadeoutin()
end end
surf.target(0) surf.target(0)
@@ -76,16 +79,16 @@ function stage1_ending.update_scene(self)
-- Acabar ending -- Acabar ending
if self.time>=800 then if self.time>=800 then
flow:next() states:next()
end end
end end
function stage1_ending.end_scene() function stage1_ending.end_scene()
print("END") print("END")
flow:finish() states:finish()
end end
flow:registrar("stage1_ending",{ states:registrar("stage1_ending",{
stage1_ending.update, stage1_ending.update,
stage1_ending.end_scene stage1_ending.end_scene
}) })
+21 -21
View File
@@ -21,7 +21,7 @@
-- print("") -- print("")
-- end -- end
flow={ 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)} ...}
actiu = "", -- nom del registre actiu actiu = "", -- nom del registre actiu
stack = {}, -- guarda els canvis de registre per a poder tornar a l'estat anterior stack = {}, -- guarda els canvis de registre per a poder tornar a l'estat anterior
@@ -30,31 +30,31 @@ flow={
} }
function flow:safe() function states:safe()
if not flow.safe_show then if not states.safe_show then
print("[FLOW] No hi ha res en la pila") print("[STATES] No hi ha res en la pila")
flow.safe_show = true states.safe_show = true
end end
end end
function flow:registrar(nom, _path) function states:registrar(nom, _path)
print("[FLOW] 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(self.registre[nom].ptr)
end end
function flow:borrar(nom) function states:borrar(nom)
self.registre[nom].ptr=0 self.registre[nom].ptr=0
self.registre[nom].path=nil self.registre[nom].path=nil
end end
function flow:add(nom) function states:add(nom)
print("[FLOW] add "..nom) print("[STATES] add "..nom)
self.add_stack[#self.add_stack+1] = nom self.add_stack[#self.add_stack+1] = nom
end end
function flow:executar(nom, stacking) function states:executar(nom, stacking)
print("[FLOW] EXEC "..nom) print("[STATES] EXEC "..nom)
if stacking then if stacking then
-- table.insert(self.stack, self.actiu) -- table.insert(self.stack, self.actiu)
self.stack[#self.stack+1] = self.actiu self.stack[#self.stack+1] = self.actiu
@@ -71,11 +71,11 @@ function flow:executar(nom, stacking)
self:next() self:next()
end end
function flow:next() function states:next()
print("[FLOW] NEXT "..self.actiu); print("[STATES] NEXT "..self.actiu);
local ptr = self.registre[self.actiu].ptr local ptr = self.registre[self.actiu].ptr
local steps = #self.registre[self.actiu].path local steps = #self.registre[self.actiu].path
-- print("FLOW_NEXT= "..self.actiu..", "..ptr..", "..steps) -- print("STATES_NEXT= "..self.actiu..", "..ptr..", "..steps)
if ptr+1>steps then if ptr+1>steps then
self:finish() self:finish()
else else
@@ -86,13 +86,13 @@ function flow:next()
return self.actiu, self.registre[self.actiu].ptr return self.actiu, self.registre[self.actiu].ptr
end end
function flow:finish() function states:finish()
print("[FLOW] FINISH "..self.actiu); print("[STATES] FINISH "..self.actiu);
self.actiu = table.remove(self.stack) self.actiu = table.remove(self.stack)
print("[FLOW] ACTIU "..self.actiu); print("[STATES] ACTIU "..self.actiu);
if self.actiu==nil then if self.actiu==nil then
-- no queda res en la pila -- no queda res en la pila
self.actiu="flow" self.actiu="states"
self.registre[self.actiu].ptr = 1 self.registre[self.actiu].ptr = 1
else else
-- ultim element afegit a la pila -- ultim element afegit a la pila
@@ -104,9 +104,9 @@ function flow:finish()
self.registre[self.actiu].ptr = 1 self.registre[self.actiu].ptr = 1
end end
end end
local curr_flow = self.registre[self.actiu] local curr_states = self.registre[self.actiu]
local ptr = self.registre[self.actiu].ptr local ptr = self.registre[self.actiu].ptr
game_update = self.registre[self.actiu].path[self.registre[self.actiu].ptr] game_update = self.registre[self.actiu].path[self.registre[self.actiu].ptr]
end end
flow:registrar("flow",{flow.safe}) states:registrar("states",{states.safe})
+4 -4
View File
@@ -33,7 +33,7 @@ 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)
flow:next() states:next()
end end
function title_draw_frame () function title_draw_frame ()
@@ -164,12 +164,12 @@ end
function to_game() function to_game()
print("to game") print("to game")
fade.fadeoutin() fade.fadeoutin()
flow:executar("game") states:executar("game")
end end
function to_options() function to_options()
print("to options") print("to options")
flow:executar("opcions", true) states:executar("opcions", true)
end end
flow:registrar("title", {title_init, title_show, title_end}) states:registrar("title", {title_init, title_show, title_end})
+3 -3
View File
@@ -124,8 +124,8 @@ function triggers:escena_abad_porta_batman()
end end
function triggers:escena_habitacio_batman() function triggers:escena_habitacio_batman()
if abad.objects.clau_premiere==nil and if abad.objects.clau_premiere~=nil and
abad.objects.clau_elalien==nil abad.objects.clau_elalien~=nil
then then
-- switches.start(0,0) -- switches.start(0,0)
local trigger_porta = trigger.new(abad.hab,1,1,triggers.open_door,"switch","porta acces cacaus","",{20, 53,41}) local trigger_porta = trigger.new(abad.hab,1,1,triggers.open_door,"switch","porta acces cacaus","",{20, 53,41})
@@ -146,7 +146,7 @@ function triggers:escena_stage1_ending()
print("STAGE 1 ENDING") print("STAGE 1 ENDING")
-- abad.update = abad_nop -- abad.update = abad_nop
remove_actor(self) remove_actor(self)
flow:executar("stage1_ending", true) states:executar("stage1_ending", true)
-- live_scene.start("stage1_ending", "add") -- live_scene.start("stage1_ending", "add")
-- start_scene(scenes.stage1_ending, nil, false) -- start_scene(scenes.stage1_ending, nil, false)
end end
+12 -4
View File
@@ -4,7 +4,7 @@ trigger_event = {
trigger_ev = {} trigger_ev = {}
function trigger_event.new ( _name, _tr_func, _tr_init, _tr_update, _a, _b, _time, _text, _distancia ) function trigger_event.new ( _name, _tr_func, _tr_init, _tr_update, _a, _b, _time, _text, _distancia, _hab, _collision_req )
table.insert( trigger_event.list, { table.insert( trigger_event.list, {
name = _name, name = _name,
trigger = _tr_func, trigger = _tr_func,
@@ -14,8 +14,10 @@ function trigger_event.new ( _name, _tr_func, _tr_init, _tr_update, _a, _b, _tim
actor_b = _b, actor_b = _b,
time = _time, time = _time,
text = _text, text = _text,
hab = _hab,
distancia = _distancia, distancia = _distancia,
enabled = true, enabled = true,
collision_req = _collision_req,
running = false, running = false,
}) })
end end
@@ -125,9 +127,15 @@ end
-- DIALEG GENERAL -- DIALEG GENERAL
function trigger_ev:dialeg_trigger () function trigger_ev:dialeg_trigger ()
if h_collision( self.actor, self.actor_b ) and local in_hab = false
distancia ( self.actor, self.actor_b )<=self.distancia if (self.hab~=nil and self.hab==self.actor.hab) or self.hab==nil then in_hab=true end
then
local is_collision = true
if self.collision_req then
is_collision = h_collision( self.actor, self.actor_b )
end
if in_hab and is_collision and distancia ( self.actor, self.actor_b )<=self.distancia then
self:init() self:init()
return true return true
end end