Funkin/source/MenuItem.hx

42 lines
1.1 KiB
Haxe
Raw Normal View History

2020-10-30 17:18:26 -04:00
package;
import flixel.FlxSprite;
import flixel.graphics.frames.FlxAtlasFrames;
import flixel.group.FlxSpriteGroup;
2020-10-30 17:55:20 -04:00
import flixel.math.FlxMath;
2020-10-30 17:18:26 -04:00
class MenuItem extends FlxSpriteGroup
{
2020-10-30 17:55:20 -04:00
public var targetY:Float = 0;
2020-10-30 21:55:09 -04:00
public var week:FlxSprite;
2020-10-30 17:55:20 -04:00
2020-11-06 05:21:29 -05:00
public function new(x:Float, y:Float, weekNum:Int = 0)
2020-10-30 17:18:26 -04:00
{
super(x, y);
2021-02-08 16:34:48 -05:00
var tex = Paths.getSparrowAtlas('campaign_menu_UI_assets');
2020-10-30 17:18:26 -04:00
2020-10-30 21:55:09 -04:00
week = new FlxSprite();
2020-10-30 17:18:26 -04:00
week.frames = tex;
2020-11-06 05:21:29 -05: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-12-11 04:15:24 -05:00
week.animation.addByPrefix('week3', "Week 3 press", 24);
2020-12-27 05:57:45 -05:00
week.animation.addByPrefix('week4', "Week 4 press", 24);
2021-01-20 05:31:43 -05:00
week.animation.addByPrefix('week5', "week 5", 24);
2021-02-02 02:20:14 -05:00
week.animation.addByPrefix('week6', "Week 6", 24);
2020-10-30 17:18:26 -04:00
add(week);
2020-10-30 17:55:20 -04:00
week.animation.play('week' + weekNum);
2020-10-30 21:55:09 -04:00
week.animation.pause();
2020-10-30 17:18:26 -04:00
week.updateHitbox();
}
2020-10-30 17:55:20 -04:00
override function update(elapsed:Float)
{
super.update(elapsed);
y = FlxMath.lerp(y, (targetY * 120) + 480, 0.17);
}
2020-10-30 17:18:26 -04:00
}