1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-11-15 19:33:36 +00:00
Funkin/source/funkin/ui/freeplay/backcards/NewCharacterCard.hx

279 lines
8.4 KiB
Haxe
Raw Normal View History

2024-08-30 00:02:32 +00:00
package funkin.ui.freeplay.backcards;
import funkin.ui.freeplay.FreeplayState;
import flash.display.BitmapData;
import flixel.FlxCamera;
import flixel.math.FlxMath;
import flixel.FlxSprite;
import flixel.group.FlxGroup;
import flixel.group.FlxGroup.FlxTypedGroup;
import flixel.group.FlxSpriteGroup.FlxTypedSpriteGroup;
import flixel.math.FlxAngle;
import flixel.math.FlxPoint;
import flixel.text.FlxText;
import flixel.tweens.FlxEase;
import flixel.tweens.FlxTween;
import flixel.util.FlxColor;
import flixel.util.FlxSpriteUtil;
import flixel.util.FlxTimer;
import funkin.graphics.adobeanimate.FlxAtlasSprite;
import funkin.graphics.FunkinSprite;
import funkin.ui.freeplay.charselect.PlayableCharacter;
import funkin.ui.MusicBeatSubState;
import lime.utils.Assets;
import openfl.display.BlendMode;
import flixel.group.FlxSpriteGroup;
import funkin.graphics.shaders.AdjustColorShader;
import flixel.addons.display.FlxTiledSprite;
import flixel.addons.display.FlxBackdrop;
class NewCharacterCard extends BackingCard
{
var confirmAtlas:FlxAtlasSprite;
var darkBg:FlxSprite;
var lightLayer:FlxSprite;
var multiply1:FlxSprite;
var multiply2:FlxSprite;
var lightLayer2:FlxSprite;
var lightLayer3:FlxSprite;
var yellow:FlxSprite;
var multiplyBar:FlxSprite;
var bruh:FlxSprite;
public var friendFoe:BGScrollingText;
public var newUnlock1:BGScrollingText;
public var waiting:BGScrollingText;
public var newUnlock2:BGScrollingText;
public var friendFoe2:BGScrollingText;
public var newUnlock3:BGScrollingText;
public override function applyExitMovers(?exitMovers:FreeplayState.ExitMoverData, ?exitMoversCharSel:FreeplayState.ExitMoverData):Void
{
super.applyExitMovers(exitMovers, exitMoversCharSel);
if (exitMovers == null || exitMoversCharSel == null) return;
exitMovers.set([friendFoe],
{
x: FlxG.width * 2,
speed: 0.4,
});
exitMovers.set([newUnlock1],
{
x: -newUnlock1.width * 2,
y: newUnlock1.y,
speed: 0.4,
wait: 0
});
exitMovers.set([waiting],
{
x: FlxG.width * 2,
speed: 0.4,
});
exitMovers.set([newUnlock2],
{
x: -newUnlock2.width * 2,
speed: 0.5,
});
exitMovers.set([friendFoe2],
{
x: FlxG.width * 2,
speed: 0.4
});
exitMovers.set([newUnlock3],
{
x: -newUnlock3.width * 2,
speed: 0.3
});
exitMoversCharSel.set([friendFoe, newUnlock1, waiting, newUnlock2, friendFoe2, newUnlock3, multiplyBar], {
y: -60,
speed: 0.8,
wait: 0.1
});
}
public override function introDone():Void
{
// pinkBack.color = 0xFFFFD863;
darkBg.visible = true;
friendFoe.visible = true;
newUnlock1.visible = true;
waiting.visible = true;
newUnlock2.visible = true;
friendFoe2.visible = true;
newUnlock3.visible = true;
multiplyBar.visible = true;
lightLayer.visible = true;
multiply1.visible = true;
multiply2.visible = true;
lightLayer2.visible = true;
yellow.visible = true;
lightLayer3.visible = true;
cardGlow.visible = true;
FlxTween.tween(cardGlow, {alpha: 0, "scale.x": 1.2, "scale.y": 1.2}, 0.45, {ease: FlxEase.sineOut});
}
public override function enterCharSel():Void
{
FlxTween.tween(friendFoe, {speed: 0}, 0.8, {ease: FlxEase.sineIn});
FlxTween.tween(newUnlock1, {speed: 0}, 0.8, {ease: FlxEase.sineIn});
FlxTween.tween(waiting, {speed: 0}, 0.8, {ease: FlxEase.sineIn});
FlxTween.tween(newUnlock2, {speed: 0}, 0.8, {ease: FlxEase.sineIn});
FlxTween.tween(friendFoe2, {speed: 0}, 0.8, {ease: FlxEase.sineIn});
FlxTween.tween(newUnlock3, {speed: 0}, 0.8, {ease: FlxEase.sineIn});
}
public override function init():Void
{
FlxTween.tween(pinkBack, {x: 0}, 0.6, {ease: FlxEase.quartOut});
add(pinkBack);
confirmTextGlow.blend = BlendMode.ADD;
confirmTextGlow.visible = false;
confirmGlow.blend = BlendMode.ADD;
confirmGlow.visible = false;
confirmGlow2.visible = false;
friendFoe = new BGScrollingText(0, 163, "COULD IT BE A NEW FRIEND? OR FOE??", FlxG.width, true, 43);
newUnlock1 = new BGScrollingText(-440, 215, 'NEW UNLOCK!', FlxG.width / 2, true, 80);
waiting = new BGScrollingText(0, 286, "SOMEONE'S WAITING!", FlxG.width / 2, true, 43);
newUnlock2 = new BGScrollingText(-220, 331, 'NEW UNLOCK!', FlxG.width / 2, true, 80);
friendFoe2 = new BGScrollingText(0, 402, 'COULD IT BE A NEW FRIEND? OR FOE??', FlxG.width, true, 43);
newUnlock3 = new BGScrollingText(0, 458, 'NEW UNLOCK!', FlxG.width / 2, true, 80);
darkBg = new FlxSprite(0, 0).loadGraphic(Paths.image('freeplay/backingCards/newCharacter/darkback'));
add(darkBg);
friendFoe.funnyColor = 0xFF139376;
friendFoe.speed = -4;
add(friendFoe);
newUnlock1.funnyColor = 0xFF99BDF2;
newUnlock1.speed = 2;
add(newUnlock1);
waiting.funnyColor = 0xFF40EA84;
waiting.speed = -2;
add(waiting);
newUnlock2.funnyColor = 0xFF99BDF2;
newUnlock2.speed = 2;
add(newUnlock2);
friendFoe2.funnyColor = 0xFF139376;
friendFoe2.speed = -4;
add(friendFoe2);
newUnlock3.funnyColor = 0xFF99BDF2;
newUnlock3.speed = 2;
add(newUnlock3);
multiplyBar = new FlxSprite(-10, 440).loadGraphic(Paths.image('freeplay/backingCards/newCharacter/multiplyBar'));
multiplyBar.blend = BlendMode.MULTIPLY;
add(multiplyBar);
lightLayer = new FlxSprite(-360, 230).loadGraphic(Paths.image('freeplay/backingCards/newCharacter/orange gradient'));
lightLayer.blend = BlendMode.ADD;
add(lightLayer);
multiply1 = new FlxSprite(-15, -125).loadGraphic(Paths.image('freeplay/backingCards/newCharacter/red'));
multiply1.blend = BlendMode.MULTIPLY;
add(multiply1);
multiply2 = new FlxSprite(-15, -125).loadGraphic(Paths.image('freeplay/backingCards/newCharacter/red'));
multiply2.blend = BlendMode.MULTIPLY;
add(multiply2);
lightLayer2 = new FlxSprite(-360, 230).loadGraphic(Paths.image('freeplay/backingCards/newCharacter/orange gradient'));
lightLayer2.blend = BlendMode.ADD;
add(lightLayer2);
yellow = new FlxSprite(0, 0).loadGraphic(Paths.image('freeplay/backingCards/newCharacter/yellow bg piece'));
yellow.blend = BlendMode.MULTIPLY;
add(yellow);
lightLayer3 = new FlxSprite(-360, 290).loadGraphic(Paths.image('freeplay/backingCards/newCharacter/red gradient'));
lightLayer3.blend = BlendMode.ADD;
add(lightLayer3);
cardGlow.blend = BlendMode.ADD;
cardGlow.visible = false;
add(cardGlow);
darkBg.visible = false;
friendFoe.visible = false;
newUnlock1.visible = false;
waiting.visible = false;
newUnlock2.visible = false;
friendFoe2.visible = false;
newUnlock3.visible = false;
multiplyBar.visible = false;
lightLayer.visible = false;
multiply1.visible = false;
multiply2.visible = false;
lightLayer2.visible = false;
yellow.visible = false;
lightLayer3.visible = false;
}
var _timer:Float = 0;
override public function update(elapsed:Float):Void
{
super.update(elapsed);
_timer += elapsed * 2;
var sinTest:Float = (Math.sin(_timer) + 1) / 2;
lightLayer.alpha = FlxMath.lerp(0.4, 1, sinTest);
lightLayer2.alpha = FlxMath.lerp(0.2, 0.5, sinTest);
lightLayer3.alpha = FlxMath.lerp(0.1, 0.7, sinTest);
multiply1.alpha = FlxMath.lerp(1, 0.21, sinTest);
multiply2.alpha = FlxMath.lerp(1, 0.21, sinTest);
yellow.alpha = FlxMath.lerp(0.2, 0.72, sinTest);
if (instance != null)
{
instance.angleMaskShader.extraColor = FlxColor.interpolate(0xFF2E2E46, 0xFF60607B, sinTest);
}
}
public override function disappear():Void
{
FlxTween.color(pinkBack, 0.25, 0xFF05020E, 0xFFFFD0D5, {ease: FlxEase.quadOut});
darkBg.visible = false;
friendFoe.visible = false;
newUnlock1.visible = false;
waiting.visible = false;
newUnlock2.visible = false;
friendFoe2.visible = false;
newUnlock3.visible = false;
multiplyBar.visible = false;
lightLayer.visible = false;
multiply1.visible = false;
multiply2.visible = false;
lightLayer2.visible = false;
yellow.visible = false;
lightLayer3.visible = false;
cardGlow.visible = true;
cardGlow.alpha = 1;
cardGlow.scale.set(1, 1);
FlxTween.tween(cardGlow, {alpha: 0, "scale.x": 1.2, "scale.y": 1.2}, 0.25, {ease: FlxEase.sineOut});
}
override public function confirm():Void
{
// confirmAtlas.visible = true;
// confirmAtlas.anim.play("");
}
}