You Can Save High Scores From Game To Game
1. On gameOver, Ask their name and save their score
In the gameOver code, add the following:
// handle game over condition on gameOver answer "You crashed, game over " set the bottom of btn "bird" to 400 ask "What is your name?" if it is not empty then put it into theName put specialFolderPath("Documents") & "/Scores.txt" into myFile put URL ("file:" & myFile ) into highScores put theName & tab & field "score" & return after highScores put highScores into URL ( "File:" & myFile) end if end gameOver
2. To See All the High Scores, add a button "Scores" and put the following into the script of the button:
put specialFolderPath("documents") & "/Scores.txt" into myFile
put url ("file:" & myFile) into x
sort lines of x numeric descending by item 2 of each
|