mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2024-11-27 09:13:18 +00:00
cool menu movement
This commit is contained in:
parent
9b53f111a2
commit
c11564e065
|
@ -3,10 +3,13 @@ package;
|
|||
import flixel.FlxSprite;
|
||||
import flixel.graphics.frames.FlxAtlasFrames;
|
||||
import flixel.group.FlxSpriteGroup;
|
||||
import flixel.math.FlxMath;
|
||||
|
||||
class MenuItem extends FlxSpriteGroup
|
||||
{
|
||||
public function new(x:Float, y:Float, week:Int = 0, unlocked:Bool = false)
|
||||
public var targetY:Float = 0;
|
||||
|
||||
public function new(x:Float, y:Float, weekNum:Int = 0, unlocked:Bool = false)
|
||||
{
|
||||
super(x, y);
|
||||
|
||||
|
@ -18,7 +21,7 @@ class MenuItem extends FlxSpriteGroup
|
|||
week.animation.addByPrefix('week1', "week2 select", 24);
|
||||
add(week);
|
||||
|
||||
week.animation.play('week' + week);
|
||||
week.animation.play('week' + weekNum);
|
||||
week.updateHitbox();
|
||||
|
||||
if (!unlocked)
|
||||
|
@ -29,7 +32,13 @@ class MenuItem extends FlxSpriteGroup
|
|||
lock.frames = tex;
|
||||
lock.animation.addByPrefix('lock', 'lock');
|
||||
lock.animation.play('lock');
|
||||
add(lock);
|
||||
// add(lock);
|
||||
}
|
||||
}
|
||||
|
||||
override function update(elapsed:Float)
|
||||
{
|
||||
super.update(elapsed);
|
||||
y = FlxMath.lerp(y, (targetY * 120) + 480, 0.17);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package;
|
|||
import flixel.FlxG;
|
||||
import flixel.FlxSprite;
|
||||
import flixel.graphics.frames.FlxAtlasFrames;
|
||||
import flixel.group.FlxGroup.FlxTypedGroup;
|
||||
import flixel.text.FlxText;
|
||||
|
||||
using StringTools;
|
||||
|
@ -17,6 +18,8 @@ class StoryMenuState extends MusicBeatState
|
|||
|
||||
var txtTracklist:FlxText;
|
||||
|
||||
var grpWeekText:FlxTypedGroup<MenuItem>;
|
||||
|
||||
override function create()
|
||||
{
|
||||
scoreText = new FlxText(10, 10, 0, "SCORE: 49324858", 36);
|
||||
|
@ -33,6 +36,9 @@ class StoryMenuState extends MusicBeatState
|
|||
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);
|
||||
|
||||
for (i in 0...weekData.length)
|
||||
{
|
||||
var unlocked:Bool = true;
|
||||
|
@ -41,7 +47,11 @@ class StoryMenuState extends MusicBeatState
|
|||
unlocked = false;
|
||||
|
||||
var weekThing:MenuItem = new MenuItem(0, yellowBG.y + yellowBG.height + 10, i, unlocked);
|
||||
add(weekThing);
|
||||
weekThing.y += ((weekThing.height + 20) * i);
|
||||
weekThing.targetY = i;
|
||||
grpWeekText.add(weekThing);
|
||||
|
||||
weekThing.screenCenter(X);
|
||||
}
|
||||
|
||||
add(yellowBG);
|
||||
|
@ -80,6 +90,14 @@ class StoryMenuState extends MusicBeatState
|
|||
if (curWeek < 0)
|
||||
curWeek = weekData.length - 1;
|
||||
|
||||
var bullShit:Int = 0;
|
||||
|
||||
for (item in grpWeekText.members)
|
||||
{
|
||||
item.targetY = bullShit - curWeek;
|
||||
bullShit++;
|
||||
}
|
||||
|
||||
updateText();
|
||||
}
|
||||
|
||||
|
@ -94,7 +112,7 @@ class StoryMenuState extends MusicBeatState
|
|||
txtTracklist.text += "\n" + i;
|
||||
}
|
||||
|
||||
txtTracklist.text.toUpperCase();
|
||||
txtTracklist.text = txtTracklist.text.toUpperCase();
|
||||
|
||||
txtTracklist.screenCenter(X);
|
||||
txtTracklist.x -= FlxG.width * 0.35;
|
||||
|
|
Loading…
Reference in a new issue