mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2025-01-11 14:48:02 +00:00
WEEK SCORE SHIT
This commit is contained in:
parent
4a715a86a0
commit
c2b17d4e3e
|
@ -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)
|
||||
|
|
|
@ -37,6 +37,7 @@ class PlayState extends MusicBeatState
|
|||
public static var curLevel:String = 'Tutorial';
|
||||
public static var SONG:SwagSong;
|
||||
public static var isStoryMode:Bool = false;
|
||||
public static var storyWeek:Int = 0;
|
||||
public static var storyPlaylist:Array<String> = [];
|
||||
public static var storyDifficulty:Int = 1;
|
||||
|
||||
|
@ -83,6 +84,8 @@ class PlayState extends MusicBeatState
|
|||
var talking:Bool = true;
|
||||
var songScore:Int = 0;
|
||||
|
||||
public static var campaignScore:Int = 0;
|
||||
|
||||
override public function create()
|
||||
{
|
||||
// var gameCam:FlxCamera = FlxG.camera;
|
||||
|
@ -825,6 +828,8 @@ class PlayState extends MusicBeatState
|
|||
|
||||
if (isStoryMode)
|
||||
{
|
||||
campaignScore += songScore;
|
||||
|
||||
storyPlaylist.remove(storyPlaylist[0]);
|
||||
|
||||
if (storyPlaylist.length <= 0)
|
||||
|
@ -836,6 +841,7 @@ class PlayState extends MusicBeatState
|
|||
StoryMenuState.weekUnlocked[1] = true;
|
||||
|
||||
NGio.unlockMedal(60961);
|
||||
Highscore.saveWeekScore(storyWeek, campaignScore, storyDifficulty);
|
||||
|
||||
FlxG.save.data.weekUnlocked = StoryMenuState.weekUnlocked;
|
||||
FlxG.save.flush();
|
||||
|
|
|
@ -5,6 +5,7 @@ import flixel.FlxSprite;
|
|||
import flixel.graphics.frames.FlxAtlasFrames;
|
||||
import flixel.group.FlxGroup.FlxTypedGroup;
|
||||
import flixel.group.FlxGroup;
|
||||
import flixel.math.FlxMath;
|
||||
import flixel.text.FlxText;
|
||||
import flixel.tweens.FlxTween;
|
||||
import flixel.util.FlxTimer;
|
||||
|
@ -149,7 +150,7 @@ class StoryMenuState extends MusicBeatState
|
|||
txtTracklist.color = 0xFFe55777;
|
||||
add(txtTracklist);
|
||||
// add(rankText);
|
||||
// add(scoreText);
|
||||
add(scoreText);
|
||||
|
||||
updateText();
|
||||
|
||||
|
@ -159,7 +160,9 @@ class StoryMenuState extends MusicBeatState
|
|||
override function update(elapsed:Float)
|
||||
{
|
||||
// scoreText.setFormat('VCR OSD Mono', 32);
|
||||
// scoreText.text = "Score SHIT";
|
||||
lerpScore = Math.floor(FlxMath.lerp(lerpScore, intendedScore, 0.5));
|
||||
|
||||
scoreText.text = "WEEK SCORE:" + lerpScore;
|
||||
// FlxG.watch.addQuick('font', scoreText.font);
|
||||
|
||||
difficultySelectors.visible = weekUnlocked[curWeek];
|
||||
|
@ -244,6 +247,7 @@ class StoryMenuState extends MusicBeatState
|
|||
PlayState.storyDifficulty = curDifficulty;
|
||||
|
||||
PlayState.SONG = Song.loadFromJson(PlayState.storyPlaylist[0].toLowerCase() + diffic, PlayState.storyPlaylist[0].toLowerCase());
|
||||
PlayState.storyWeek = curWeek;
|
||||
new FlxTimer().start(1, function(tmr:FlxTimer)
|
||||
{
|
||||
if (FlxG.sound.music != null)
|
||||
|
@ -281,10 +285,14 @@ class StoryMenuState extends MusicBeatState
|
|||
|
||||
// USING THESE WEIRD VALUES SO THAT IT DOESNT FLOAT UP
|
||||
sprDifficulty.y = leftArrow.y - 15;
|
||||
intendedScore = Highscore.getWeekScore(curWeek, curDifficulty);
|
||||
|
||||
FlxTween.tween(sprDifficulty, {y: leftArrow.y + 15, alpha: 1}, 0.07);
|
||||
}
|
||||
|
||||
var lerpScore:Int = 0;
|
||||
var intendedScore:Int = 0;
|
||||
|
||||
function changeWeek(change:Int = 0):Void
|
||||
{
|
||||
curWeek += change;
|
||||
|
@ -329,5 +337,7 @@ class StoryMenuState extends MusicBeatState
|
|||
|
||||
txtTracklist.screenCenter(X);
|
||||
txtTracklist.x -= FlxG.width * 0.35;
|
||||
|
||||
intendedScore = Highscore.getWeekScore(curWeek, curDifficulty);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -74,7 +74,7 @@ class TitleState extends MusicBeatState
|
|||
}
|
||||
|
||||
#if SKIP_TO_PLAYSTATE
|
||||
FlxG.switchState(new FreeplayState());
|
||||
FlxG.switchState(new StoryMenuState());
|
||||
#else
|
||||
startIntro();
|
||||
#end
|
||||
|
|
Loading…
Reference in a new issue