我對Lua非常陌生,我的代碼讓我感到困惑,我只是爲了練習而製作迷宮遊戲,並且遇到了一個錯誤,每次運行我的代碼時它都會循環,而不是去下一部分。我將不勝感激任何幫助。我的代碼不斷循環
我的代碼:
print ("Welcome to the maze")
input = ""
while input ~= "leave" do
print ("What do you want to do first? Leave or inspect?")
input = io.read()
if input == "inspect" then
print (" You venture towards the maze.")
end
if input == "leave" then
print ("You turn around and run.")
end
end
input = ""
while input ~= "turn around" do
print ("There is a path, which do you want to take, left, right or turn around?")
input = io.read()
if input == "left" then
print (" You turn left to the dark trees.")
end
if input == "right" then
print ("You turn right to the light pathway.")
end
if input == "turn around" then
print ("You turn around and run.")
end
end
林不知道爲什麼代碼已經搞砸了,但心不是它是如何,其對賽特正常的我。 – matthewwaring
你是第一次來嗎? –
你是什麼意思? – matthewwaring