SCORE

Hi,

I have a score that adds down every time you move an object, until 0. The problem i have is every time it counts down, the numbers start piling up on top of each other. They are not even noticeable,is there an way to fix this? To remove the previous score, so you can see the next?

Thanks.

it must be something like this, i suppose

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
local score = 100
local scoreTxt = display.newText("",100,50,native.systemFont,20)
local obj = display.newRect(0,0,50,50)
obj.x = 150; obj.y = 150
 
local function addscore(event)
        obj.x = event.x
        if score > 0 then
        score = score - 1
        scoreTxt.text = score
end
end
 
 
obj:addEventListener("touch", addscore)
views:1329 update:2011/9/27 18:14:54
corona forums © 2003-2011