-1
我試着去創造我的遊戲隨機字母的答案,但問題是,它不會檢測圖像請幫助...企圖指數的upvalue「信」的錯誤或因arr_str [I]
local s = answer --answer
local len = string.len(answer)
local str
local j
for j=1,len do
str = s:sub(j,j)
arr_str[j]= str
end
for i = 1, #arr_str do
local j = math.random(1,#arr_str)
arr_str[i], arr_str[j] = arr_str[j], arr_str[i]
end
local max = #arr_str
local rowMax = max
--if max > 8 then rowMax = 8 end
local gap = 35
local xPos = halfW - (rowMax/2*35) + 17.5
local yPos = bottom - 20
local startpos = xPos
for i= 1, #arr_str do
slot = display.newImageRect("images/bg_slot.png", 43, 43)
slot.x = xPos; slot.y = yPos -40
slotgroup:insert(slot)
slot1 = display.newImageRect("images/ans_slot.png", 43, 43)
slot1.x = xPos; slot1.y = yPos
slotgroup:insert(slot1)
print("ERROR",arr_str[i])
letter = display.newImageRect("letters/uc/".. arr_str[i] ..".png",50,50)
letter.name = arr_str[i]
letter.x = xPos; letter.y = yPos
letter.idBg = i
lettergroup:insert(letter)
xPos = xPos + gap
Alreay修復問題謝謝你的答案..真的很感激它。 – 2014-11-07 09:08:24