[NEW] Dialeg funcionant.

This commit is contained in:
2026-04-22 22:30:34 +02:00
parent a811ece34f
commit ea19c43865
4 changed files with 68 additions and 12 deletions

View File

@@ -2,7 +2,19 @@ dialeg={
list = {},
}
dialegs = {}
function dialeg.update()
for i,d in ipairs(dialegs) do
if distancia(d.actor1, d.actor2, d.direccio)<=d.distancia and d.enabled then
dialeg.new(d.text, d.actor1)
d.enabled=false
end
end
end
function dialeg.new( _text, _actor )
print(_text)
table.insert(
dialeg.list,
{
@@ -14,10 +26,10 @@ function dialeg.new( _text, _actor )
} )
end
function dialeg:draw( )
function dialeg.draw( )
local i = 1
while i <= #self.list do
local d = self.list[i]
while i <= #dialeg.list do
local d = dialeg.list[i]
if d.time>0 and d.actor then
if viewp:inside(d.actor.x, d.actor.y, d.actor.w, d.actor.h) then
@@ -53,11 +65,10 @@ function dialeg:draw( )
font.current(font_curr)
d.time = d.time-1
i = i + 1
end
i = i + 1
else
table.remove(self.list, i)
table.remove(dialeg.list, i)
end
end
end