I want to make a program that saves the high score of the game.How should I programme?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Ali
am 12 Dez. 2014
Beantwortet: Image Analyst
am 15 Dez. 2014
I want to make a program that saves the high score of the game.How should I code to do this? Thanks!
0 Kommentare
Akzeptierte Antwort
Image Analyst
am 15 Dez. 2014
Is it the kind of game where the score can only increase? Or can it ever decrease? Actually, it doesn't matter. Let's say you have an array called scores that keeps track of all scores - whenever there is a new score you add an element. The high score is just
highScore = max(scores);
To save that to a file, just use save():
save(matFillFileName, 'highScore');
0 Kommentare
Weitere Antworten (1)
Star Strider
am 12 Dez. 2014
I don’t know what the game is, but I assume the score increases to the end. I would use the max function.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Strategy & Logic finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!