Corona SCORE

Hello to all!

I wanted some help on how to create a scoring system, a score that I want to do that every second I aumenti.E then when I lose I get a screen with the total points.

I have done so, but I can not see the screen to do the score, but only in the terminal:

    scoretext = display.newText(“Score :”, 10, 3, native.systemFont, 15)

    local scoretext

    local score = 0

    

    local function countDown ()

         score = score + 20

         print ("Score: "…score)

    end

    

    scoretext = timer.performWithDelay(1000,  countDown, 0)

Sorry for the English, but I’m using the translator.

I have to learn English well :slight_smile:

Should be

scoretext.text ="Score: "…score

Not print

    In the terminal I see everything, text + score. in the iphone simulator (display) I only see scoretext

    scoretext = display.newText(“Score :”, 10, 3, native.systemFont, 15)

    local scoretext

    local score = 0

    

    local function countDown ()

         score = score + 20

         scoretext.text=("score: "…score)

         print ("Score: "…score)

    end

    scoretext = timer.performWithDelay(1000,  countDown, 0)

local scoretext is over writing the scoretext variable. move it above scoretext = display…

sorry I did not understand, you say that?

local scoretext

local score

scoretext = display.newText(“Score :”, 10, 3, native.systemFont, 15)

   

local function countDown ()

    score = score + 20

    scoretext.text=("score: "…score)

    print ("Score: "…score)

end

scoretext = timer.performWithDelay(1000,  countDown, 0) 

??? 

identical 

Your over writing the scorerext variable with the timer call. Everything needs it’s on variable

Sorry you can write it correctly?

I can not understand

Sorry

try this

local scoretext local score = 0   scoretext = display.newText("Score :", 10, 3, native.systemFont, 15)   local function countDown ()     score = score + 20     scoretext.text=("Score: "..score)     print ("Score: "..score) end   updateScore = timer.performWithDelay(1000,  countDown, 0)

The error was simple

Thank you very much, sorry for the many demands, but they are new and not very good with English.

If I wanted instead that when an “object” touches another object?

Thanks again

no problem i like helping

as for as detecting when one object touches another it depends if your using physics or not.

i dont use physics  much so maybe someone else can help with that.

if your not using physics, they have collision detection code here there are others around also

also look at this for non physics collision detection

http://www.coronalabs.com/blog/2013/07/23/tutorial-non-physics-collision-detection/

Perfect, I’ll look right now, if I need anything else I write a new post

Thanks jstrahan  :smiley:

And if I stop running? or the timer?

Should be

scoretext.text ="Score: "…score

Not print

    In the terminal I see everything, text + score. in the iphone simulator (display) I only see scoretext

    scoretext = display.newText(“Score :”, 10, 3, native.systemFont, 15)

    local scoretext

    local score = 0

    

    local function countDown ()

         score = score + 20

         scoretext.text=("score: "…score)

         print ("Score: "…score)

    end

    scoretext = timer.performWithDelay(1000,  countDown, 0)

local scoretext is over writing the scoretext variable. move it above scoretext = display…

sorry I did not understand, you say that?

local scoretext

local score

scoretext = display.newText(“Score :”, 10, 3, native.systemFont, 15)

   

local function countDown ()

    score = score + 20

    scoretext.text=("score: "…score)

    print ("Score: "…score)

end

scoretext = timer.performWithDelay(1000,  countDown, 0) 

??? 

identical 

Your over writing the scorerext variable with the timer call. Everything needs it’s on variable

Sorry you can write it correctly?

I can not understand

Sorry

try this

local scoretext local score = 0   scoretext = display.newText("Score :", 10, 3, native.systemFont, 15)   local function countDown ()     score = score + 20     scoretext.text=("Score: "..score)     print ("Score: "..score) end   updateScore = timer.performWithDelay(1000,  countDown, 0)

The error was simple

Thank you very much, sorry for the many demands, but they are new and not very good with English.

If I wanted instead that when an “object” touches another object?

Thanks again