caught up to cam

This commit is contained in:
Brandon
2020-11-06 21:17:27 -05:00
parent 86e526d553
commit f8fe10bebf
20 changed files with 369 additions and 85 deletions

View File

@ -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;
@ -16,12 +17,12 @@ class StoryMenuState extends MusicBeatState
{
var scoreText:FlxText;
var weekData:Array<Dynamic> = [['Tutorial', 'Bopeebo', 'Fresh', 'Dadbattle'], ['Spookeez', 'South']];
var weekData:Array<Dynamic> = [['Tutorial'], ['Bopeebo', 'Fresh', 'Dadbattle'], ['Spookeez', 'South']];
var curDifficulty:Int = 1;
public static var weekUnlocked:Array<Bool> = [true, false];
public static var weekUnlocked:Array<Bool> = [true, true, false];
var weekCharacters:Array<Dynamic> = [['dad', 'bf', 'gf'], ['spooky', 'bf', 'gf']];
var weekCharacters:Array<Dynamic> = [['dad', 'bf', 'gf'], ['dad', 'bf', 'gf'], ['spooky', 'bf', 'gf']];
var curWeek:Int = 0;
var txtTracklist:FlxText;
@ -38,8 +39,11 @@ class StoryMenuState extends MusicBeatState
override function create()
{
if (!FlxG.sound.music.playing)
FlxG.sound.playMusic('assets/music/freakyMenu' + TitleState.soundExt);
if (FlxG.sound.music != null)
{
if (!FlxG.sound.music.playing)
FlxG.sound.playMusic('assets/music/freakyMenu' + TitleState.soundExt);
}
persistentUpdate = persistentDraw = true;
@ -65,12 +69,7 @@ class StoryMenuState extends MusicBeatState
for (i in 0...weekData.length)
{
var unlocked:Bool = true;
if (i == 1)
unlocked = false;
var weekThing:MenuItem = new MenuItem(0, yellowBG.y + yellowBG.height + 10, i, unlocked);
var weekThing:MenuItem = new MenuItem(0, yellowBG.y + yellowBG.height + 10, i);
weekThing.y += ((weekThing.height + 20) * i);
weekThing.targetY = i;
grpWeekText.add(weekThing);
@ -79,6 +78,7 @@ class StoryMenuState extends MusicBeatState
weekThing.antialiasing = true;
// weekThing.updateHitbox();
// Needs an offset thingie
if (!weekUnlocked[i])
{
var lock:FlxSprite = new FlxSprite(weekThing.width + 10 + weekThing.x);
@ -117,7 +117,7 @@ class StoryMenuState extends MusicBeatState
difficultySelectors = new FlxGroup();
add(difficultySelectors);
leftArrow = new FlxSprite(grpWeekText.members[0].x + 370, grpWeekText.members[0].y + 10);
leftArrow = new FlxSprite(grpWeekText.members[0].x + grpWeekText.members[0].width + 10, grpWeekText.members[0].y + 10);
leftArrow.frames = ui_tex;
leftArrow.animation.addByPrefix('idle', "arrow left");
leftArrow.animation.addByPrefix('press', "arrow push left");
@ -150,7 +150,7 @@ class StoryMenuState extends MusicBeatState
txtTracklist.color = 0xFFe55777;
add(txtTracklist);
// add(rankText);
// add(scoreText);
add(scoreText);
updateText();
@ -160,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];
@ -245,6 +247,8 @@ class StoryMenuState extends MusicBeatState
PlayState.storyDifficulty = curDifficulty;
PlayState.SONG = Song.loadFromJson(PlayState.storyPlaylist[0].toLowerCase() + diffic, PlayState.storyPlaylist[0].toLowerCase());
PlayState.storyWeek = curWeek;
PlayState.campaignScore = 0;
new FlxTimer().start(1, function(tmr:FlxTimer)
{
if (FlxG.sound.music != null)
@ -282,10 +286,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;
@ -300,6 +308,10 @@ class StoryMenuState extends MusicBeatState
for (item in grpWeekText.members)
{
item.targetY = bullShit - curWeek;
if (item.targetY == Std.int(0) && weekUnlocked[curWeek])
item.alpha = 1;
else
item.alpha = 0.6;
bullShit++;
}
@ -326,5 +338,7 @@ class StoryMenuState extends MusicBeatState
txtTracklist.screenCenter(X);
txtTracklist.x -= FlxG.width * 0.35;
intendedScore = Highscore.getWeekScore(curWeek, curDifficulty);
}
}