Corona sdk:得分

时间:2013-10-14 18:14:16

标签: iphone lua 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

提前致谢:)

1 个答案:

答案 0 :(得分: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 

如何从该功能中获取价值。试试这样。