From 0d3e116d886da520bb4273be7f0b3c33777d6845 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Mon, 1 Mar 2021 18:59:51 -0500 Subject: [PATCH] freeplay menu polish thingie --- assets/preload/data/freeplaySonglist.txt | 5 +---- assets/{shared => preload}/images/iconGrid.png | Bin source/FreeplayState.hx | 10 +++++++++- source/HealthIcon.hx | 13 +++++++++++++ 4 files changed, 23 insertions(+), 5 deletions(-) rename assets/{shared => preload}/images/iconGrid.png (100%) diff --git a/assets/preload/data/freeplaySonglist.txt b/assets/preload/data/freeplaySonglist.txt index d3a753978..1b5bac2cd 100644 --- a/assets/preload/data/freeplaySonglist.txt +++ b/assets/preload/data/freeplaySonglist.txt @@ -1,4 +1 @@ -Tutorial -Bopeebo -Fresh -Dadbattle \ No newline at end of file +Tutorial \ No newline at end of file diff --git a/assets/shared/images/iconGrid.png b/assets/preload/images/iconGrid.png similarity index 100% rename from assets/shared/images/iconGrid.png rename to assets/preload/images/iconGrid.png diff --git a/source/FreeplayState.hx b/source/FreeplayState.hx index d00b40264..464ba7452 100644 --- a/source/FreeplayState.hx +++ b/source/FreeplayState.hx @@ -34,7 +34,7 @@ class FreeplayState extends MusicBeatState for (i in 0...initSonglist.length) { - songs.push(new SongMetadata(initSonglist[i], 1, 'dad')); + songs.push(new SongMetadata(initSonglist[i], 1, 'gf')); } /* @@ -51,6 +51,9 @@ class FreeplayState extends MusicBeatState isDebug = true; #end + if (StoryMenuState.weekUnlocked[2] || isDebug) + addWeek(['Bopeebo', 'Fresh', 'Dadbattle'], 1, ['dad']); + if (StoryMenuState.weekUnlocked[2] || isDebug) addWeek(['Spookeez', 'South', 'Monster'], 2, ['spooky']); @@ -82,6 +85,11 @@ class FreeplayState extends MusicBeatState songText.isMenuItem = true; songText.targetY = i; grpSongs.add(songText); + + var icon:HealthIcon = new HealthIcon(songs[i].songCharacter); + icon.sprTracker = songText; + add(icon); + // songText.x += 40; // DONT PUT X IN THE FIRST PARAMETER OF new ALPHABET() !! // songText.screenCenter(X); diff --git a/source/HealthIcon.hx b/source/HealthIcon.hx index a7c71578a..ff967e990 100644 --- a/source/HealthIcon.hx +++ b/source/HealthIcon.hx @@ -4,6 +4,11 @@ import flixel.FlxSprite; class HealthIcon extends FlxSprite { + /** + * Used for FreeplayState! If you use it elsewhere, prob gonna annoying + */ + public var sprTracker:FlxSprite; + public function new(char:String = 'bf', isPlayer:Bool = false) { super(); @@ -32,4 +37,12 @@ class HealthIcon extends FlxSprite animation.play(char); scrollFactor.set(); } + + override function update(elapsed:Float) + { + super.update(elapsed); + + if (sprTracker != null) + setPosition(sprTracker.x + sprTracker.width + 10, sprTracker.y - 30); + } }