1
有人可以幫助理清這個錯誤嗎?Corona SDK addEventListener
的addEventListener必須調用的函數問題...
--ship as a custom attribute with the value of false
rects[i][j].ship = false
--Add an event listener to get tappedRect called
rects:addEventListener("tap" ,tappedRect)
end
end
--TappedRect function use when a rectangle gets tapped on
function tappedRect(event)
if event.target.ship then
event.target.ship = true
event.target:setFillColor(0, 255, 0)
else
event.target = false
event.target:setFillColor(255, 0, 0)
end
end
在rects之前是tappedRect:addEventListener?另外,試着在這裏寫一些更好的代碼。有版本選項。 – Fayer