WEEK SCORE SHIT

This commit is contained in:
Cameron Taylor
2020-11-06 02:56:45 -08:00
parent 054e9f4bf9
commit cf7b871c56
5 changed files with 43 additions and 4 deletions

View File

@ -21,6 +21,21 @@ class Highscore
setScore(daSong, score);
}
public static function saveWeekScore(week:Int = 1, score:Int = 0, ?diff:Int = 0):Void
{
NGio.postScore(score, "Week " + week);
var daWeek:String = formatSong('week' + week, diff);
if (songScores.exists(daWeek))
{
if (songScores.get(daWeek) < score)
setScore(daWeek, score);
}
else
setScore(daWeek, score);
}
/**
* YOU SHOULD FORMAT SONG WITH formatSong() BEFORE TOSSING IN SONG VARIABLE
*/
@ -52,6 +67,14 @@ class Highscore
return songScores.get(formatSong(song, diff));
}
public static function getWeekScore(week:Int, diff:Int):Int
{
if (!songScores.exists(formatSong('week' + week, diff)))
setScore(formatSong('week' + week, diff), 0);
return songScores.get(formatSong('week' + week, diff));
}
public static function load():Void
{
if (FlxG.save.data.songScores != null)