caught up 10/30/
This commit is contained in:
172
source/StoryMenuState.hx
Normal file
172
source/StoryMenuState.hx
Normal file
@ -0,0 +1,172 @@
|
||||
package;
|
||||
|
||||
import flixel.FlxG;
|
||||
import flixel.FlxSprite;
|
||||
import flixel.graphics.frames.FlxAtlasFrames;
|
||||
import flixel.group.FlxGroup.FlxTypedGroup;
|
||||
import flixel.group.FlxGroup;
|
||||
import flixel.text.FlxText;
|
||||
|
||||
using StringTools;
|
||||
|
||||
class StoryMenuState extends MusicBeatState
|
||||
{
|
||||
var scoreText:FlxText;
|
||||
|
||||
var weekData:Array<Dynamic> = [['Tutorial', 'Bopeebo', 'Fresh', 'Dad Battle'], ['Spookeez', 'South', 'Monster']];
|
||||
var weekUnlocked:Array<Bool> = [true, false];
|
||||
|
||||
var curWeek:Int = 0;
|
||||
|
||||
var txtTracklist:FlxText;
|
||||
|
||||
var grpWeekText:FlxTypedGroup<MenuItem>;
|
||||
|
||||
var grpLocks:FlxTypedGroup<FlxSprite>;
|
||||
|
||||
var difficultySelectors:FlxGroup;
|
||||
|
||||
override function create()
|
||||
{
|
||||
scoreText = new FlxText(10, 10, 0, "SCORE: 49324858", 36);
|
||||
scoreText.setFormat("VCR OSD Mono", 32);
|
||||
add(scoreText);
|
||||
|
||||
var rankText:FlxText = new FlxText(0, 10);
|
||||
rankText.text = 'RANK: GREAT';
|
||||
rankText.setFormat("assets/fonts/vcr.ttf", 32);
|
||||
rankText.size = scoreText.size;
|
||||
rankText.screenCenter(X);
|
||||
add(rankText);
|
||||
|
||||
var ui_tex = FlxAtlasFrames.fromSparrow(AssetPaths.campaign_menu_UI_assets__png, AssetPaths.campaign_menu_UI_assets__xml);
|
||||
var yellowBG:FlxSprite = new FlxSprite(0, 56).makeGraphic(FlxG.width, 400, 0xFFF9CF51);
|
||||
|
||||
grpWeekText = new FlxTypedGroup<MenuItem>();
|
||||
add(grpWeekText);
|
||||
|
||||
grpLocks = new FlxTypedGroup<FlxSprite>();
|
||||
add(grpLocks);
|
||||
|
||||
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);
|
||||
weekThing.y += ((weekThing.height + 20) * i);
|
||||
weekThing.targetY = i;
|
||||
grpWeekText.add(weekThing);
|
||||
|
||||
weekThing.screenCenter(X);
|
||||
weekThing.antialiasing = true;
|
||||
// weekThing.updateHitbox();
|
||||
|
||||
if (!weekUnlocked[i])
|
||||
{
|
||||
var lock:FlxSprite = new FlxSprite(weekThing.width + 10 + weekThing.x);
|
||||
lock.frames = ui_tex;
|
||||
lock.animation.addByPrefix('lock', 'lock');
|
||||
lock.animation.play('lock');
|
||||
lock.ID = i;
|
||||
lock.antialiasing = true;
|
||||
grpLocks.add(lock);
|
||||
}
|
||||
}
|
||||
|
||||
difficultySelectors = new FlxGroup();
|
||||
add(difficultySelectors);
|
||||
|
||||
var leftArrow:FlxSprite = new FlxSprite(grpWeekText.members[0].x + 400, grpWeekText.members[0].y + 10);
|
||||
leftArrow.frames = ui_tex;
|
||||
leftArrow.animation.addByPrefix('idle', "arrow left");
|
||||
leftArrow.animation.play('idle');
|
||||
difficultySelectors.add(leftArrow);
|
||||
|
||||
var sprDifficulty:FlxSprite = new FlxSprite(leftArrow.x + 70, leftArrow.y);
|
||||
sprDifficulty.frames = ui_tex;
|
||||
sprDifficulty.animation.addByPrefix('easy', 'EASY');
|
||||
sprDifficulty.animation.addByPrefix('normal', 'NORMAL');
|
||||
sprDifficulty.animation.addByPrefix('hard', 'HARD');
|
||||
sprDifficulty.animation.play('easy');
|
||||
difficultySelectors.add(sprDifficulty);
|
||||
|
||||
var rightArrow:FlxSprite = new FlxSprite(sprDifficulty.x + sprDifficulty.width + 20, sprDifficulty.y);
|
||||
rightArrow.frames = ui_tex;
|
||||
rightArrow.animation.addByPrefix('idle', 'arrow right');
|
||||
rightArrow.animation.play('idle');
|
||||
difficultySelectors.add(rightArrow);
|
||||
|
||||
add(yellowBG);
|
||||
|
||||
txtTracklist = new FlxText(FlxG.width * 0.05, yellowBG.x + yellowBG.height + 100, 0, "Tracks", 32);
|
||||
txtTracklist.alignment = CENTER;
|
||||
txtTracklist.font = rankText.font;
|
||||
txtTracklist.color = 0xFFe55777;
|
||||
add(txtTracklist);
|
||||
|
||||
updateText();
|
||||
|
||||
super.create();
|
||||
}
|
||||
|
||||
override function update(elapsed:Float)
|
||||
{
|
||||
// scoreText.setFormat('VCR OSD Mono', 32);
|
||||
// scoreText.text = "Score SHIT";
|
||||
// FlxG.watch.addQuick('font', scoreText.font);
|
||||
|
||||
difficultySelectors.visible = weekUnlocked[curWeek];
|
||||
|
||||
grpLocks.forEach(function(lock:FlxSprite)
|
||||
{
|
||||
lock.y = grpWeekText.members[lock.ID].y;
|
||||
});
|
||||
|
||||
if (controls.UP_P)
|
||||
changeWeek(-1);
|
||||
if (controls.DOWN_P)
|
||||
changeWeek(1);
|
||||
|
||||
super.update(elapsed);
|
||||
}
|
||||
|
||||
function changeWeek(change:Int = 0):Void
|
||||
{
|
||||
curWeek += change;
|
||||
|
||||
if (curWeek >= weekData.length)
|
||||
curWeek = 0;
|
||||
if (curWeek < 0)
|
||||
curWeek = weekData.length - 1;
|
||||
|
||||
var bullShit:Int = 0;
|
||||
|
||||
for (item in grpWeekText.members)
|
||||
{
|
||||
item.targetY = bullShit - curWeek;
|
||||
bullShit++;
|
||||
}
|
||||
|
||||
updateText();
|
||||
}
|
||||
|
||||
function updateText()
|
||||
{
|
||||
txtTracklist.text = "Tracks\n";
|
||||
|
||||
var stringThing:Array<String> = weekData[curWeek];
|
||||
|
||||
for (i in stringThing)
|
||||
{
|
||||
txtTracklist.text += "\n" + i;
|
||||
}
|
||||
|
||||
txtTracklist.text = txtTracklist.text.toUpperCase();
|
||||
|
||||
txtTracklist.screenCenter(X);
|
||||
txtTracklist.x -= FlxG.width * 0.35;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user