- Afegit objecte "wait"

This commit is contained in:
2023-01-31 16:01:05 +01:00
parent 2fb0749cf7
commit db844e634c
3 changed files with 24 additions and 2 deletions

View File

@@ -3,4 +3,4 @@ config=ja2
width=160 width=160
height=144 height=144
zoom=5 zoom=5
files=switches.lua,scene.lua,balloon.lua,actors.lua,game.lua,mapa.lua,editor.lua,textbox.lua,menu.lua,main.lua files=wait.lua,switches.lua,scene.lua,balloon.lua,actors.lua,game.lua,mapa.lua,editor.lua,textbox.lua,menu.lua,main.lua

View File

@@ -16,7 +16,9 @@ game={
flags.usu1=true flags.usu1=true
scene.start({ scene.start({
function() actors.search("usufondo").path={pos=0,route='rrrruro'} end, function() actors.search("usufondo").path={pos=0,route='rrrruro'} end,
function() balloon.show("HOLA\nQUE TAL?","usufondo",true) end function() balloon.show("HOLA\nQUE TAL?","usufondo",true) end,
function() wait.start(1) end,
function() balloon.show("PAYASO...","jailer",true) end
}) })
end end
end end

20
data/wait.lua Normal file
View File

@@ -0,0 +1,20 @@
wait={
start_time=0,
total_time=0,
old_update=nil,
start=function(seconds)
wait.old_update=update
update=wait.update
wait.total_time=seconds
wait.start_time=time()
end,
update=function()
wait.old_update()
if wait.total_time <= time()-wait.start_time then
update=wait.old_update
scene.cont()
end
end
}