Scores

Hi,
I was wondering if someone would share how to use scores.
What I mean by that is what code do I use to display a score. [import]uid: 81530 topic_id: 13451 reply_id: 313451[/import]

The code to display your score will look like:

[lua]local myText = display.newText("", 0, 0, native.systemFont, 12)
myText:setTextColor(255, 255, 255)

myText.text = “Hello World!”
myText.size = 16[/lua] [import]uid: 63320 topic_id: 13451 reply_id: 49364[/import]

that doesn’t tell me how to configure scores [import]uid: 81530 topic_id: 13451 reply_id: 49370[/import]

Can you be more specific on what you’re asking? I gave you code to display a label which you could use to display and update a score. [import]uid: 63320 topic_id: 13451 reply_id: 49373[/import]

sorry I am being unclear…
I have a game, and I want to know how to assign scores
I hope I am being a little but clearer [import]uid: 81530 topic_id: 13451 reply_id: 49375[/import]

Assign scores? As in you want more than one score?

Maybe you are asking how to update it - the text?

If so, that’s easy. Based on the code above you would have your text;

[lua]local myText = display.newText("", 0, 0, native.systemFont, 12)
myText:setTextColor(255, 255, 255)

myText.text = “Hello World!”
myText.size = 16[/lua]

You would have a variable called score;

[lua]score = 0[/lua]

Then you’d have functions that made the score go up, and show in your text, like this;

[lua]score = score + 1
myText = score[/lua]

Is that what you were asking? (Sorry if it’s not, sometimes you have to be REALLY specific with this kind of thing :wink:

Peach [import]uid: 52491 topic_id: 13451 reply_id: 49444[/import]

Thanks Peach, that’s all I was trying to find out!
:slight_smile: [import]uid: 81530 topic_id: 13451 reply_id: 49480[/import]

Yes! Excellent!

I always worry when I don’t totally know what the other person wants and take a guess - I’m very happy that was what you wanted :slight_smile: [import]uid: 52491 topic_id: 13451 reply_id: 49737[/import]