几天前我开始学习LUA,在桌面模拟器游戏中开始了我自己的项目,但是我碰壁了。我无法为等待课程增加时间。
这是我尝试过的一个例子:
function state_check()
--This function checks if the state of obj_1 and obj_2 is 0 or 1
end
function press_button()
--This function activates other functions based on the state of obj_1 and obj_2
i = 1 --Function starts with a wait of 1 second
if obj_1_state == 1 then --If state is 1, then the function is triggered and 1 second is added to i
Wait.time(func_1, i)
i = i + 1
end
if obj_2_state == 1 then
Wait.time(func_2, i)
end
end
我需要该功能检查第一部分,如果为真,请在 1 秒后执行第二部分。如果没有,请正常执行第二部分并跳过“i = i + 1”。我的问题是该函数同时执行所有操作。我知道我做错了什么,但我不知道是什么。有没有办法创建一些门来按顺序或类似的事情做所有事情?