1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-11-24 15:56:30 +00:00
Funkin/source/MenuItem.hx

38 lines
931 B
Haxe
Raw Normal View History

2020-10-30 23:47:19 +00:00
package;
import flixel.FlxSprite;
import flixel.graphics.frames.FlxAtlasFrames;
import flixel.group.FlxSpriteGroup;
import flixel.math.FlxMath;
class MenuItem extends FlxSpriteGroup
{
public var targetY:Float = 0;
2020-11-01 01:11:14 +00:00
public var week:FlxSprite;
2020-10-30 23:47:19 +00:00
2020-11-07 02:17:27 +00:00
public function new(x:Float, y:Float, weekNum:Int = 0)
2020-10-30 23:47:19 +00:00
{
super(x, y);
var tex = FlxAtlasFrames.fromSparrow(AssetPaths.campaign_menu_UI_assets__png, AssetPaths.campaign_menu_UI_assets__xml);
2020-11-01 01:11:14 +00:00
week = new FlxSprite();
2020-10-30 23:47:19 +00:00
week.frames = tex;
2020-11-07 02:17:27 +00:00
// TUTORIAL IS WEEK 0
week.animation.addByPrefix('week0', 'tutorial selected', 24);
week.animation.addByPrefix('week1', "WEEK1 select", 24);
week.animation.addByPrefix('week2', "week2 select", 24);
2020-10-30 23:47:19 +00:00
add(week);
week.animation.play('week' + weekNum);
2020-11-01 01:11:14 +00:00
week.animation.pause();
2020-10-30 23:47:19 +00:00
week.updateHitbox();
}
override function update(elapsed:Float)
{
super.update(elapsed);
y = FlxMath.lerp(y, (targetY * 120) + 480, 0.17);
}
}