WEEK SCORE SHIT

This commit is contained in:
Cameron Taylor committed 2020-11-06 02:56:45 -08:00
1 parent 054e9f4bf9
commit cf7b871c56
5 files changed
+43 -4

No files matched your search

+1 -1
View File
@@ -1 +1 @@
{"song":{"song":"Dadbattle","bpm":180,"sections":45,"notes":[{"mustHitSection":true,"typeOfSection":0,"lengthInSteps":16,"sectionNotes":[]},{"mustHitSection":true,"typeOfSection":0,"lengthInSteps":16,"sectionNotes":[]},{"mustHitSection":true,"typeOfSection":0,"lengthInSteps":16,"sectionNotes":[]},{"mustHitSection":true,"typeOfSection":0,"lengthInSteps":16,"sectionNotes":[]},{"mustHitSection":true,"typeOfSection":0,"lengthInSteps":16,"sectionNotes":[]},{"mustHitSection":true,"typeOfSection":0,"lengthInSteps":16,"sectionNotes":[]},{"mustHitSection":true,"typeOfSection":0,"lengthInSteps":16,"sectionNotes":[]},{"mustHitSection":true,"typeOfSection":0,"lengthInSteps":16,"sectionNotes":[]},{"mustHitSection":false,"typeOfSection":0,"lengthInSteps":16,"sectionNotes":[[10667,2,0],[11000,0,0],[11167,1,0],[11333,2,0],[11750,0,0],[11833,3,0]]},{"mustHitSection":false,"typeOfSection":0,"lengthInSteps":16,"sectionNotes":[[12000,2,0],[12167,3,0],[12333,0,0],[12500,1,0],[12667,2,0],[13083,0,0],[13250,3,0]]},{"mustHitSection":true,"typeOfSection":0,"lengthInSteps":16,"sectionNotes":[[13333.666666666666,2,0],[13666.666666666666,0,0],[13833.666666666666,1,0],[13999.666666666666,2,0],[14416.666666666666,0,0],[14499.666666666666,3,0]]},{"mustHitSection":true,"typeOfSection":0,"lengthInSteps":16,"sectionNotes":[[14666.666666666666,2,0],[14833.666666666666,3,0],[14999.666666666666,0,0],[15166.666666666666,1,0],[15333.666666666666,2,0],[15749.666666666666,0,0],[15916.666666666666,3,0]]},{"mustHitSection":false,"typeOfSection":0,"lengthInSteps":16,"sectionNotes":[[16000,1,0],[16333,0,0],[16500,3,0],[16667,1,0],[16917,2,0]]},{"mustHitSection":false,"typeOfSection":0,"lengthInSteps":16,"sectionNotes":[[17348,1,0],[17750,0,0],[17917,0,0],[18083,3,0],[18250,3,0],[18417,3,0],[18583,3,0]]},{"mustHitSection":true,"typeOfSection":0,"lengthInSteps":16,"sectionNotes":[[18666.666666666668,1,0],[18999.666666666668,0,0],[19166.666666666668,3,0],[19333.666666666668,1,0],[19583.666666666668,2,0]]},{"mustHitSection":true,"typeOfSection":0,"lengthInSteps":16,"sectionNotes":[[20014.666666666668,1,0],[20416.666666666668,0,0],[20583.666666666668,0,0],[20749.666666666668,3,0],[20916.666666666668,3,0],[21083.666666666668,3,0],[21249.666666666668,3,0]]},{"mustHitSection":false,"typeOfSection":0,"lengthInSteps":16,"sectionNotes":[[21750,2,0],[21917,1,0],[22083,3,0]]},{"mustHitSection":false,"typeOfSection":0,"lengthInSteps":16,"sectionNotes":[[22833,1,0],[23000,3,0],[23250,0,0]]},{"mustHitSection":false,"typeOfSection":0,"lengthInSteps":16,"sectionNotes":[[24417,2,0],[24750,1,0],[25000,0,0],[25167,1,0]]},{"mustHitSection":false,"typeOfSection":0,"lengthInSteps":16,"sectionNotes":[[25342,2,0],[25500,3,0],[25583,0,0],[25750,1,0],[25917,3,0],[26083,2,0]]},{"mustHitSection":true,"typeOfSection":0,"lengthInSteps":16,"sectionNotes":[[27083.333333333332,2,0],[27250.333333333332,1,0],[27416.333333333332,3,0]]},{"mustHitSection":true,"typeOfSection":0,"lengthInSteps":16,"sectionNotes":[[28166.333333333332,1,0],[28333.333333333332,3,0],[28583.333333333332,0,0]]},{"mustHitSection":true,"typeOfSection":0,"lengthInSteps":16,"sectionNotes":[[29750.333333333332,2,0],[30083.333333333332,1,0],[30333.333333333332,0,0],[30500.333333333332,1,0]]},{"mustHitSection":true,"typeOfSection":0,"lengthInSteps":16,"sectionNotes":[[30675.333333333332,2,0],[30833.333333333332,3,0],[30916.333333333332,0,0],[31083.333333333332,1,0],[31250.333333333332,3,0],[31416.333333333332,2,0]]},{"mustHitSection":false,"typeOfSection":0,"lengthInSteps":16,"sectionNotes":[[32167,0,0],[32333,3,0],[32500,2,0],[32750,1,0],[33000,0,0]]},{"mustHitSection":false,"typeOfSection":0,"lengthInSteps":16,"sectionNotes":[[33500,2,0],[33667,3,0],[33833,1,0],[34083,2,0],[34417,0,0]]},{"mustHitSection":false,"typeOfSection":0,"lengthInSteps":16,"sectionNotes":[[34669,0,0],[35000,1,0],[35333,3,0],[35667,1,0]]},{"mustHitSection":false,"typeOfSection":0,"lengthInSteps":16,"sectionNotes":[[36008,2,0],[36333,3,0],[36750,0,0],[36750,1,0]]},{"mustHitSection":false,"typeOfSection":0,"lengthInSteps":16,"sectionNotes":[[37583,1,0],[37750,3,0],[37917,2,0],[38083,0,0],[38167,2,0],[38333,1,0]]},{"mustHitSection":false,"typeOfSection":0,"lengthInSteps":16,"sectionNotes":[[38679,0,0],[38750,3,0],[38833,0,0],[39000,1,0],[39167,0,0],[39333,2,0],[39500,3,0],[39667,1,0]]},{"mustHitSection":false,"typeOfSection":0,"lengthInSteps":16,"sectionNotes":[[40167,0,0],[40333,3,0],[40500,1,0],[40750,2,0],[40917,3,0],[41083,1,0],[41250,3,0]]},{"mustHitSection":false,"typeOfSection":0,"lengthInSteps":16,"sectionNotes":[[41337,4,0],[41750,6,0],[41583,5,0],[41917,7,0],[42083,6,0],[42250,5,0],[42417,4,0],[42583,5,0],[41348,0,0],[41583,1,0],[41750,0,0],[41917,3,0],[42167,2,0],[42333,3,0]]},{"mustHitSection":true,"typeOfSection":0,"lengthInSteps":16,"sectionNotes":[[42833.666666666664,0,0],[42999.666666666664,3,0],[43166.666666666664,2,0],[43416.666666666664,1,0],[43666.666666666664,0,0]]},{"mustHitSection":true,"typeOfSection":0,"lengthInSteps":16,"sLine truncated {"song":{"song":"Dadbattle","bpm":180,"sections":45,"notes":[{"mustHitSection":true,"typeOfSection":0,"lengthInSteps":16,"sectionNotes":[]},{"mustHitSection":true,"typeOfSection":0,"lengthInSteps":16,"sectionNotes":[]},{"mustHitSection":true,"typeOfSection":0,"lengthInSteps":16,"sectionNotes":[]},{"mustHitSection":true,"typeOfSection":0,"lengthInSteps":16,"sectionNotes":[]},{"mustHitSection":true,"typeOfSection":0,"lengthInSteps":16,"sectionNotes":[]},{"mustHitSection":true,"typeOfSection":0,"lengthInSteps":16,"sectionNotes":[]},{"mustHitSection":true,"typeOfSection":0,"lengthInSteps":16,"sectionNotes":[]},{"mustHitSection":true,"typeOfSection":0,"lengthInSteps":16,"sectionNotes":[]},{"mustHitSection":false,"typeOfSection":0,"lengthInSteps":16,"sectionNotes":[[10667,2,0],[11000,0,0],[11167,1,0],[11333,2,0],[11750,0,0],[11833,3,0]]},{"mustHitSection":false,"typeOfSection":0,"lengthInSteps":16,"sectionNotes":[[12000,2,0],[12167,3,0],[12333,0,0],[12500,1,0],[12667,2,0],[13083,0,0],[13250,3,0]]},{"mustHitSection":true,"typeOfSection":0,"lengthInSteps":16,"sectionNotes":[[13333.666666666666,2,0],[13666.666666666666,0,0],[13833.666666666666,1,0],[13999.666666666666,2,0],[14416.666666666666,0,0],[14499.666666666666,3,0]]},{"mustHitSection":true,"typeOfSection":0,"lengthInSteps":16,"sectionNotes":[[14666.666666666666,2,0],[14833.666666666666,3,0],[14999.666666666666,0,0],[15166.666666666666,1,0],[15333.666666666666,2,0],[15749.666666666666,0,0],[15916.666666666666,3,0]]},{"mustHitSection":false,"typeOfSection":0,"lengthInSteps":16,"sectionNotes":[[16000,1,0],[16333,0,0],[16500,3,0],[16667,1,0],[16917,2,0]]},{"mustHitSection":false,"typeOfSection":0,"lengthInSteps":16,"sectionNotes":[[17348,1,0],[17750,0,0],[17917,0,0],[18083,3,0],[18250,3,0],[18417,3,0],[18583,3,0]]},{"mustHitSection":true,"typeOfSection":0,"lengthInSteps":16,"sectionNotes":[[18666.666666666668,1,0],[18999.666666666668,0,0],[19166.666666666668,3,0],[19333.666666666668,1,0],[19583.666666666668,2,0]]},{"mustHitSection":true,"typeOfSection":0,"lengthInSteps":16,"sectionNotes":[[20014.666666666668,1,0],[20416.666666666668,0,0],[20583.666666666668,0,0],[20749.666666666668,3,0],[20916.666666666668,3,0],[21083.666666666668,3,0],[21249.666666666668,3,0]]},{"mustHitSection":false,"typeOfSection":0,"lengthInSteps":16,"sectionNotes":[[21750,2,0],[21917,1,0],[22083,3,0]]},{"mustHitSection":false,"typeOfSection":0,"lengthInSteps":16,"sectionNotes":[[22833,1,0],[23000,3,0],[23250,0,0]]},{"mustHitSection":false,"typeOfSection":0,"lengthInSteps":16,"sectionNotes":[[24417,2,0],[24750,1,0],[25000,0,0],[25167,1,0]]},{"mustHitSection":false,"typeOfSection":0,"lengthInSteps":16,"sectionNotes":[[25342,2,0],[25500,3,0],[25583,0,0],[25750,1,0],[25917,3,0],[26083,2,0]]},{"mustHitSection":true,"typeOfSection":0,"lengthInSteps":16,"sectionNotes":[[27083.333333333332,2,0],[27250.333333333332,1,0],[27416.333333333332,3,0]]},{"mustHitSection":true,"typeOfSection":0,"lengthInSteps":16,"sectionNotes":[[28166.333333333332,1,0],[28333.333333333332,3,0],[28583.333333333332,0,0]]},{"mustHitSection":true,"typeOfSection":0,"lengthInSteps":16,"sectionNotes":[[29750.333333333332,2,0],[30083.333333333332,1,0],[30333.333333333332,0,0],[30500.333333333332,1,0]]},{"mustHitSection":true,"typeOfSection":0,"lengthInSteps":16,"sectionNotes":[[30675.333333333332,2,0],[30833.333333333332,3,0],[30916.333333333332,0,0],[31083.333333333332,1,0],[31250.333333333332,3,0],[31416.333333333332,2,0]]},{"mustHitSection":false,"typeOfSection":0,"lengthInSteps":16,"sectionNotes":[[32167,0,0],[32333,3,0],[32500,2,0],[32750,1,0],[33000,0,0]]},{"mustHitSection":false,"typeOfSection":0,"lengthInSteps":16,"sectionNotes":[[33500,2,0],[33667,3,0],[33833,1,0],[34083,2,0],[34417,0,0]]},{"mustHitSection":false,"typeOfSection":0,"lengthInSteps":16,"sectionNotes":[[34669,0,0],[35000,1,0],[35333,3,0],[35667,1,0]]},{"mustHitSection":false,"typeOfSection":0,"lengthInSteps":16,"sectionNotes":[[36008,2,0],[36333,3,0],[36750,0,0],[36750,1,0]]},{"mustHitSection":false,"typeOfSection":0,"lengthInSteps":16,"sectionNotes":[[37583,1,0],[37750,3,0],[37917,2,0],[38083,0,0],[38167,2,0],[38333,1,0]]},{"mustHitSection":false,"typeOfSection":0,"lengthInSteps":16,"sectionNotes":[[38679,0,0],[38750,3,0],[38833,0,0],[39000,1,0],[39167,0,0],[39333,2,0],[39500,3,0],[39667,1,0]]},{"mustHitSection":false,"typeOfSection":0,"lengthInSteps":16,"sectionNotes":[[40167,0,0],[40333,3,0],[40500,1,0],[40750,2,0],[40917,3,0],[41083,1,0],[41250,3,0]]},{"mustHitSection":false,"typeOfSection":0,"lengthInSteps":16,"sectionNotes":[[41337,4,0],[41750,6,0],[41583,5,0],[41917,7,0],[42083,6,0],[42250,5,0],[42417,4,0],[42583,5,0],[41348,0,0],[41583,1,0],[41750,0,0],[41917,3,0],[42167,2,0],[42333,3,0]]},{"mustHitSection":true,"typeOfSection":0,"lengthInSteps":16,"sectionNotes":[[42833.666666666664,0,0],[42999.666666666664,3,0],[43166.666666666664,2,0],[43416.666666666664,1,0],[43666.666666666664,0,0]]},{"mustHitSection":true,"typeOfSection":0,"lengthInSteps":16,"sLine truncated
+23
View File
@@ -21,6 +21,21 @@ class Highscore
setScore(daSong, score); 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 * YOU SHOULD FORMAT SONG WITH formatSong() BEFORE TOSSING IN SONG VARIABLE
*/ */
@@ -52,6 +67,14 @@ class Highscore
return songScores.get(formatSong(song, diff)); 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 public static function load():Void
{ {
if (FlxG.save.data.songScores != null) if (FlxG.save.data.songScores != null)
+6
View File
@@ -37,6 +37,7 @@ class PlayState extends MusicBeatState
public static var curLevel:String = 'Tutorial'; public static var curLevel:String = 'Tutorial';
public static var SONG:SwagSong; public static var SONG:SwagSong;
public static var isStoryMode:Bool = false; public static var isStoryMode:Bool = false;
public static var storyWeek:Int = 0;
public static var storyPlaylist:Array<String> = []; public static var storyPlaylist:Array<String> = [];
public static var storyDifficulty:Int = 1; public static var storyDifficulty:Int = 1;
@@ -83,6 +84,8 @@ class PlayState extends MusicBeatState
var talking:Bool = true; var talking:Bool = true;
var songScore:Int = 0; var songScore:Int = 0;
public static var campaignScore:Int = 0;
override public function create() override public function create()
{ {
// var gameCam:FlxCamera = FlxG.camera; // var gameCam:FlxCamera = FlxG.camera;
@@ -825,6 +828,8 @@ class PlayState extends MusicBeatState
if (isStoryMode) if (isStoryMode)
{ {
campaignScore += songScore;
storyPlaylist.remove(storyPlaylist[0]); storyPlaylist.remove(storyPlaylist[0]);
if (storyPlaylist.length <= 0) if (storyPlaylist.length <= 0)
@@ -836,6 +841,7 @@ class PlayState extends MusicBeatState
StoryMenuState.weekUnlocked[1] = true; StoryMenuState.weekUnlocked[1] = true;
NGio.unlockMedal(60961); NGio.unlockMedal(60961);
Highscore.saveWeekScore(storyWeek, campaignScore, storyDifficulty);
FlxG.save.data.weekUnlocked = StoryMenuState.weekUnlocked; FlxG.save.data.weekUnlocked = StoryMenuState.weekUnlocked;
FlxG.save.flush(); FlxG.save.flush();
+12 -2
View File
@@ -5,6 +5,7 @@ import flixel.FlxSprite;
import flixel.graphics.frames.FlxAtlasFrames; import flixel.graphics.frames.FlxAtlasFrames;
import flixel.group.FlxGroup.FlxTypedGroup; import flixel.group.FlxGroup.FlxTypedGroup;
import flixel.group.FlxGroup; import flixel.group.FlxGroup;
import flixel.math.FlxMath;
import flixel.text.FlxText; import flixel.text.FlxText;
import flixel.tweens.FlxTween; import flixel.tweens.FlxTween;
import flixel.util.FlxTimer; import flixel.util.FlxTimer;
@@ -149,7 +150,7 @@ class StoryMenuState extends MusicBeatState
txtTracklist.color = 0xFFe55777; txtTracklist.color = 0xFFe55777;
add(txtTracklist); add(txtTracklist);
// add(rankText); // add(rankText);
// add(scoreText); add(scoreText);
updateText(); updateText();
@@ -159,7 +160,9 @@ class StoryMenuState extends MusicBeatState
override function update(elapsed:Float) override function update(elapsed:Float)
{ {
// scoreText.setFormat('VCR OSD Mono', 32); // 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); // FlxG.watch.addQuick('font', scoreText.font);
difficultySelectors.visible = weekUnlocked[curWeek]; difficultySelectors.visible = weekUnlocked[curWeek];
@@ -244,6 +247,7 @@ class StoryMenuState extends MusicBeatState
PlayState.storyDifficulty = curDifficulty; PlayState.storyDifficulty = curDifficulty;
PlayState.SONG = Song.loadFromJson(PlayState.storyPlaylist[0].toLowerCase() + diffic, PlayState.storyPlaylist[0].toLowerCase()); PlayState.SONG = Song.loadFromJson(PlayState.storyPlaylist[0].toLowerCase() + diffic, PlayState.storyPlaylist[0].toLowerCase());
PlayState.storyWeek = curWeek;
new FlxTimer().start(1, function(tmr:FlxTimer) new FlxTimer().start(1, function(tmr:FlxTimer)
{ {
if (FlxG.sound.music != null) if (FlxG.sound.music != null)
@@ -281,10 +285,14 @@ class StoryMenuState extends MusicBeatState
// USING THESE WEIRD VALUES SO THAT IT DOESNT FLOAT UP // USING THESE WEIRD VALUES SO THAT IT DOESNT FLOAT UP
sprDifficulty.y = leftArrow.y - 15; sprDifficulty.y = leftArrow.y - 15;
intendedScore = Highscore.getWeekScore(curWeek, curDifficulty);
FlxTween.tween(sprDifficulty, {y: leftArrow.y + 15, alpha: 1}, 0.07); 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 function changeWeek(change:Int = 0):Void
{ {
curWeek += change; curWeek += change;
@@ -329,5 +337,7 @@ class StoryMenuState extends MusicBeatState
txtTracklist.screenCenter(X); txtTracklist.screenCenter(X);
txtTracklist.x -= FlxG.width * 0.35; txtTracklist.x -= FlxG.width * 0.35;
intendedScore = Highscore.getWeekScore(curWeek, curDifficulty);
} }
} }
+1 -1
View File
@@ -74,7 +74,7 @@ class TitleState extends MusicBeatState
} }
#if SKIP_TO_PLAYSTATE #if SKIP_TO_PLAYSTATE
FlxG.switchState(new FreeplayState()); FlxG.switchState(new StoryMenuState());
#else #else
startIntro(); startIntro();
#end #end