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
|
|
|
|
|
|
|
public function new(x:Float, y:Float, weekNum:Int = 0, unlocked:Bool = false)
|
2020-10-30 17:18:26 -04:00
|
|
|
{
|
|
|
|
super(x, y);
|
|
|
|
|
|
|
|
var tex = FlxAtlasFrames.fromSparrow(AssetPaths.campaign_menu_UI_assets__png, AssetPaths.campaign_menu_UI_assets__xml);
|
|
|
|
|
2020-10-30 21:55:09 -04:00
|
|
|
week = new FlxSprite();
|
2020-10-30 17:18:26 -04:00
|
|
|
week.frames = tex;
|
|
|
|
week.animation.addByPrefix('week0', "WEEK1 select", 24);
|
|
|
|
week.animation.addByPrefix('week1', "week2 select", 24);
|
|
|
|
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();
|
|
|
|
|
|
|
|
if (!unlocked)
|
|
|
|
{
|
|
|
|
week.alpha = 0.6;
|
|
|
|
}
|
|
|
|
}
|
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
|
|
|
}
|