-

Sorry, but I’m not very good at translating to English, so I’m not sure what this is really about. I see you added the function highscore() to my game, but nothing is calling it. So I’m assuming you want to add the high score routine to keep track of the scores. This version is using the original game that doesn’t allow a choice of speeds, so the second version should be used if you want to make additions to make the game better. I’ll look into adding the highscore if that’s what you really want. It would also be nice if you wouldn’t modify the who() function, but added to it for additions or updates.


function who()
    fill(255)
    fontSize(15)
    text("(c) by Dave1707",-150,20)
end

@DJJ

If you were wondering about adding the 10 high scores, here is an update to add to the above program. Add showHighScore() to the endGame() function and then add the function showHighScore() anywhere you want. To clear the high scores, uncomment the clearLocalData() line in showHighScore(), run the game, then comment the line again.


function endGame()
    translate(250,60)
    drawDots()
    drawSlash()
    showScore() 
    showRestart() 
    showHighScore()    -- add this line
end



--add this function

function showHighScore()
    -- to clear the scores, uncomment clearLocalData()
    -- run the game, then comment it back.
    ---clearLocalData()
    pushStyle()
    font("Courier")
    t=total
    for x=1,10 do
        str=string.format("reddots%d",x)
        h=readLocalData(str)
        if h==nil then
            saveLocalData(str,0)
            if t>0 then
                saveLocalData(str,t)
                t=0
            end
        elseif t==tonumber(h) then
                break
        elseif t>tonumber(h) then
                saveLocalData(str,t)
                t=tonumber(h)
        end
    end    
    for x=1,10 do
        str=string.format("reddots%d",x)
        h=readLocalData(str) 
        str=string.format("%2d) %4d",x,h)
        text(str,-130,380-x*35)
    end
    popStyle()
end