From f964f69a407acada05b5e67a740e2eeb28a135e8 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Fri, 30 Oct 2020 15:21:34 -0700 Subject: [PATCH] menu shit in progress --- source/MenuItem.hx | 6 ----- source/StoryMenuState.hx | 52 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+), 6 deletions(-) diff --git a/source/MenuItem.hx b/source/MenuItem.hx index 16d0d3f25..5e7ddc763 100644 --- a/source/MenuItem.hx +++ b/source/MenuItem.hx @@ -27,12 +27,6 @@ class MenuItem extends FlxSpriteGroup if (!unlocked) { week.alpha = 0.6; - - var lock:FlxSprite = new FlxSprite(week.frameWidth + 5); - lock.frames = tex; - lock.animation.addByPrefix('lock', 'lock'); - lock.animation.play('lock'); - // add(lock); } } diff --git a/source/StoryMenuState.hx b/source/StoryMenuState.hx index aaee58f9c..bae5703c0 100644 --- a/source/StoryMenuState.hx +++ b/source/StoryMenuState.hx @@ -4,6 +4,7 @@ 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; @@ -13,6 +14,7 @@ class StoryMenuState extends MusicBeatState var scoreText:FlxText; var weekData:Array = [['Tutorial', 'Bopeebo', 'Fresh', 'Dad Battle'], ['Spookeez', 'South', 'Monster']]; + var weekUnlocked:Array = [true, false]; var curWeek:Int = 0; @@ -20,6 +22,10 @@ class StoryMenuState extends MusicBeatState var grpWeekText:FlxTypedGroup; + var grpLocks:FlxTypedGroup; + + var difficultySelectors:FlxGroup; + override function create() { scoreText = new FlxText(10, 10, 0, "SCORE: 49324858", 36); @@ -39,6 +45,9 @@ class StoryMenuState extends MusicBeatState grpWeekText = new FlxTypedGroup(); add(grpWeekText); + grpLocks = new FlxTypedGroup(); + add(grpLocks); + for (i in 0...weekData.length) { var unlocked:Bool = true; @@ -52,8 +61,44 @@ class StoryMenuState extends MusicBeatState 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); @@ -73,6 +118,13 @@ class StoryMenuState extends MusicBeatState // 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)