0

我正在尝试制作一个简单的 corona sdk 游戏,但无法正常工作。我想制作一个分数文本字段,但我有很多问题。

功能:

function points(num)
 addPoints()
 score = score + num
 scoreTxt.text = "hoi"
 scoreTxt:setReferencePoint(display.TopLeftReferencePoint)
end

function addPoints()
num = math.random(100, 350)
end 

其他一些信息:

score = 50;
num = 50;
scoreTxt = display.newText ("Score:", 0, 0, "Helvetica", 20)
scoreTxt:setReferencePoint(display.TopLeftReferencePoint)
scoreTxt.x = display.screenOriginX + 10
scoreTxt.y = display.screenOriginX + 5

提前致谢 :)

4

1 回答 1

0
function points()
 num=addPoints()
 score = score + num
 scoreTxt.text = "hoi"
 scoreTxt:setReferencePoint(display.TopLeftReferencePoint)
end

function addPoints()
num = math.random(100, 350)
return num
end 

您如何从该功能中获得价值。像这样尝试。

于 2013-10-16T05:04:36.220 回答