im new to Corona and im having a bit of a problem with my scoring system. See what happens is that when you begin the game, the score starts at 0, which it should. When the player gets a score, it should increment by two. Well it does increment its just that instead of the number 0 changing to the number 2, what i get is the number 0 and then the number 2 ON TOP of 0. So it overlays. I couldnt find any posts that actually addressed this issue, so i think im doing something wrong here. Any help? Or just point me in the right direction? Thank in advance. :)
the problem with your code is that everytime you call displayScore() function it creates another newText because you always calls
local scoreText = display.newText("Score: ", 415, 100, native.systemFont, 50)
.
try to declare the scoreText
outside the function displayScore()
just like this
local scoreText = display.newText("Score: ", 415, 100, native.systemFont, 50)
function displayScore()
scoreText:setTextColor(255, 255, 255)
scoreText.text = scoreText.text = "Score: "..score
end