0
votes

I'm trying to make a simple corona sdk game but I can't get it working. I wanne make a score text field but I have a lot of problems.

The functions:

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

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

Some other information:

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

Thanks in advance :)

1
What is your exact problem...? :O - Krishna Raj Salim
Have you tried ScrollViewWidget ? - Guy P
My problem is that my score just says 0, it doesn't change. - that guy
I haven't tried ScrollViewWidget what is it? - that guy
Already figured out how to do it :) - that guy

1 Answers

0
votes
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 

How can you get value from that function.Try like this.