mirror of
https://github.com/FunkinCrew/Funkin.git
synced 2024-11-14 19:25:16 -05:00
backing card classes
This commit is contained in:
parent
e7448cb8f7
commit
de03da7e6f
4 changed files with 653 additions and 33 deletions
|
@ -39,10 +39,14 @@ class BackingCard extends FlxSpriteGroup
|
|||
var _exitMovers:Null<FreeplayState.ExitMoverData>;
|
||||
var _exitMoversCharSel:Null<FreeplayState.ExitMoverData>;
|
||||
|
||||
public function new(currentCharacter:PlayableCharacter)
|
||||
public var instance:FreeplayState;
|
||||
|
||||
public function new(currentCharacter:PlayableCharacter, ?_instance:FreeplayState)
|
||||
{
|
||||
super();
|
||||
|
||||
if (_instance != null) instance = _instance;
|
||||
|
||||
cardGlow = new FlxSprite(-30, -30).loadGraphic(Paths.image('freeplay/cardGlow'));
|
||||
confirmGlow = new FlxSprite(-30, 240).loadGraphic(Paths.image('freeplay/confirmGlow'));
|
||||
confirmTextGlow = new FlxSprite(-8, 115).loadGraphic(Paths.image('freeplay/glowingText'));
|
||||
|
@ -115,6 +119,16 @@ class BackingCard extends FlxSpriteGroup
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function to snap the back of the card to its final position.
|
||||
* Used when returning from character select, as we dont want to play the full animation of everything sliding in.
|
||||
*/
|
||||
public function skipIntroTween():Void
|
||||
{
|
||||
FlxTween.cancelTweensOf(pinkBack);
|
||||
pinkBack.x = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called in create. Adds sprites and tweens.
|
||||
*/
|
||||
|
@ -152,11 +166,6 @@ class BackingCard extends FlxSpriteGroup
|
|||
add(cardGlow);
|
||||
}
|
||||
|
||||
/**
|
||||
* Override parts of Freeplay depending on the card class.
|
||||
*/
|
||||
public function applyStyle(_freeplayState:FreeplayState):Void {}
|
||||
|
||||
/**
|
||||
* Called after the dj finishes their start animation.
|
||||
*/
|
||||
|
@ -181,10 +190,16 @@ class BackingCard extends FlxSpriteGroup
|
|||
confirmGlow.visible = true;
|
||||
confirmGlow2.visible = true;
|
||||
|
||||
backingTextYeah.playAnimation("BF back card confirm raw", false, false, false, 0);
|
||||
backingTextYeah.anim.play("");
|
||||
confirmGlow2.alpha = 0;
|
||||
confirmGlow.alpha = 0;
|
||||
|
||||
FlxTween.color(instance.bgDad, 0.5, 0xFFA8A8A8, 0xFF646464,
|
||||
{
|
||||
onUpdate: function(_) {
|
||||
instance.angleMaskShader.extraColor = instance.bgDad.color;
|
||||
}
|
||||
});
|
||||
FlxTween.tween(confirmGlow2, {alpha: 0.5}, 0.33,
|
||||
{
|
||||
ease: FlxEase.quadOut,
|
||||
|
@ -195,12 +210,29 @@ class BackingCard extends FlxSpriteGroup
|
|||
confirmTextGlow.alpha = 1;
|
||||
FlxTween.tween(confirmTextGlow, {alpha: 0.4}, 0.5);
|
||||
FlxTween.tween(confirmGlow, {alpha: 0}, 0.5);
|
||||
FlxTween.color(instance.bgDad, 2, 0xFFCDCDCD, 0xFF555555,
|
||||
{
|
||||
ease: FlxEase.expoOut,
|
||||
onUpdate: function(_) {
|
||||
instance.angleMaskShader.extraColor = instance.bgDad.color;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when exiting the freeplay menu
|
||||
* Called when entering character select, does nothing by default.
|
||||
*/
|
||||
public function enterCharSel():Void {}
|
||||
|
||||
/**
|
||||
* Called on each beat in freeplay state.
|
||||
*/
|
||||
public function beatHit():Void {}
|
||||
|
||||
/**
|
||||
* Called when exiting the freeplay menu.
|
||||
*/
|
||||
public function disappear():Void
|
||||
{
|
||||
|
|
|
@ -22,9 +22,6 @@ import lime.utils.Assets;
|
|||
import openfl.display.BlendMode;
|
||||
import flixel.group.FlxSpriteGroup;
|
||||
|
||||
/**
|
||||
* A class for the backing cards so they dont have to be part of freeplayState......
|
||||
*/
|
||||
class BoyfriendCard extends BackingCard
|
||||
{
|
||||
public var moreWays:BGScrollingText;
|
||||
|
@ -34,6 +31,9 @@ class BoyfriendCard extends BackingCard
|
|||
public var moreWays2:BGScrollingText;
|
||||
public var funnyScroll3:BGScrollingText;
|
||||
|
||||
var glow:FlxSprite;
|
||||
var glowDark:FlxSprite;
|
||||
|
||||
public override function applyExitMovers(?exitMovers:FreeplayState.ExitMoverData, ?exitMoversCharSel:FreeplayState.ExitMoverData):Void
|
||||
{
|
||||
super.applyExitMovers(exitMovers, exitMoversCharSel);
|
||||
|
@ -79,6 +79,16 @@ class BoyfriendCard extends BackingCard
|
|||
});
|
||||
}
|
||||
|
||||
public override function enterCharSel():Void
|
||||
{
|
||||
FlxTween.tween(funnyScroll, {speed: 0}, 0.8, {ease: FlxEase.sineIn});
|
||||
FlxTween.tween(funnyScroll2, {speed: 0}, 0.8, {ease: FlxEase.sineIn});
|
||||
FlxTween.tween(moreWays, {speed: 0}, 0.8, {ease: FlxEase.sineIn});
|
||||
FlxTween.tween(moreWays2, {speed: 0}, 0.8, {ease: FlxEase.sineIn});
|
||||
FlxTween.tween(txtNuts, {speed: 0}, 0.8, {ease: FlxEase.sineIn});
|
||||
FlxTween.tween(funnyScroll3, {speed: 0}, 0.8, {ease: FlxEase.sineIn});
|
||||
}
|
||||
|
||||
public override function new(currentCharacter:PlayableCharacter)
|
||||
{
|
||||
super(currentCharacter);
|
||||
|
@ -93,10 +103,34 @@ class BoyfriendCard extends BackingCard
|
|||
|
||||
public override function init():Void
|
||||
{
|
||||
super.init();
|
||||
FlxTween.tween(pinkBack, {x: 0}, 0.6, {ease: FlxEase.quartOut});
|
||||
add(pinkBack);
|
||||
|
||||
// var grpTxtScrolls:FlxGroup = new FlxGroup();
|
||||
// add(grpTxtScrolls);
|
||||
add(orangeBackShit);
|
||||
|
||||
add(alsoOrangeLOL);
|
||||
|
||||
FlxSpriteUtil.alphaMaskFlxSprite(orangeBackShit, pinkBack, orangeBackShit);
|
||||
orangeBackShit.visible = false;
|
||||
alsoOrangeLOL.visible = false;
|
||||
|
||||
confirmTextGlow.blend = BlendMode.ADD;
|
||||
confirmTextGlow.visible = false;
|
||||
|
||||
confirmGlow.blend = BlendMode.ADD;
|
||||
|
||||
confirmGlow.visible = false;
|
||||
confirmGlow2.visible = false;
|
||||
|
||||
add(confirmGlow2);
|
||||
add(confirmGlow);
|
||||
|
||||
add(confirmTextGlow);
|
||||
|
||||
add(backingTextYeah);
|
||||
|
||||
cardGlow.blend = BlendMode.ADD;
|
||||
cardGlow.visible = false;
|
||||
|
||||
moreWays.visible = false;
|
||||
funnyScroll.visible = false;
|
||||
|
@ -127,6 +161,36 @@ class BoyfriendCard extends BackingCard
|
|||
funnyScroll3.funnyColor = 0xFFFEA400;
|
||||
funnyScroll3.speed = -3.8;
|
||||
add(funnyScroll3);
|
||||
|
||||
glowDark = new FlxSprite(-300, 330).loadGraphic(Paths.image('freeplay/beatglow'));
|
||||
glowDark.blend = BlendMode.MULTIPLY;
|
||||
add(glowDark);
|
||||
|
||||
glow = new FlxSprite(-300, 330).loadGraphic(Paths.image('freeplay/beatglow'));
|
||||
glow.blend = BlendMode.ADD;
|
||||
add(glow);
|
||||
|
||||
glowDark.visible = false;
|
||||
glow.visible = false;
|
||||
|
||||
add(cardGlow);
|
||||
}
|
||||
|
||||
var beatFreq:Int = 1;
|
||||
var beatFreqList:Array<Int> = [1,2,4,8];
|
||||
|
||||
public override function beatHit():Void {
|
||||
// increases the amount of beats that need to go by to pulse the glow because itd flash like craazy at high bpms.....
|
||||
beatFreq = beatFreqList[Math.floor(Conductor.instance.bpm/140)];
|
||||
|
||||
if(Conductor.instance.currentBeat % beatFreq != 0) return;
|
||||
FlxTween.cancelTweensOf(glow);
|
||||
FlxTween.cancelTweensOf(glowDark);
|
||||
|
||||
glow.alpha = 0.8;
|
||||
FlxTween.tween(glow, {alpha: 0}, 16/24, {ease: FlxEase.quartOut});
|
||||
glowDark.alpha = 0;
|
||||
FlxTween.tween(glowDark, {alpha: 0.6}, 18/24, {ease: FlxEase.quartOut});
|
||||
}
|
||||
|
||||
public override function introDone():Void
|
||||
|
@ -139,6 +203,8 @@ class BoyfriendCard extends BackingCard
|
|||
moreWays2.visible = true;
|
||||
funnyScroll3.visible = true;
|
||||
// grpTxtScrolls.visible = true;
|
||||
glowDark.visible = true;
|
||||
glow.visible = true;
|
||||
}
|
||||
|
||||
public override function confirm():Void
|
||||
|
@ -152,6 +218,8 @@ class BoyfriendCard extends BackingCard
|
|||
funnyScroll2.visible = false;
|
||||
moreWays2.visible = false;
|
||||
funnyScroll3.visible = false;
|
||||
glowDark.visible = false;
|
||||
glow.visible = false;
|
||||
}
|
||||
|
||||
public override function disappear():Void
|
||||
|
@ -164,5 +232,7 @@ class BoyfriendCard extends BackingCard
|
|||
funnyScroll2.visible = false;
|
||||
moreWays2.visible = false;
|
||||
funnyScroll3.visible = false;
|
||||
glowDark.visible = false;
|
||||
glow.visible = false;
|
||||
}
|
||||
}
|
||||
|
|
278
source/funkin/ui/freeplay/backcards/NewCharacterCard.hx
Normal file
278
source/funkin/ui/freeplay/backcards/NewCharacterCard.hx
Normal file
|
@ -0,0 +1,278 @@
|
|||
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("");
|
||||
}
|
||||
}
|
|
@ -1,7 +1,9 @@
|
|||
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;
|
||||
|
@ -21,25 +23,77 @@ 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;
|
||||
|
||||
/**
|
||||
* A class for the backing cards so they dont have to be part of freeplayState......
|
||||
*/
|
||||
class PicoCard extends BackingCard
|
||||
{
|
||||
var scrollBack:FlxBackdrop;
|
||||
var scrollLower:FlxBackdrop;
|
||||
var scrollTop:FlxBackdrop;
|
||||
var scrollMiddle:FlxBackdrop;
|
||||
|
||||
var glow:FlxSprite;
|
||||
var glowDark:FlxSprite;
|
||||
var blueBar:FlxSprite;
|
||||
|
||||
var confirmAtlas:FlxAtlasSprite;
|
||||
|
||||
public override function enterCharSel():Void
|
||||
{
|
||||
FlxTween.tween(scrollBack.velocity, {x: 0}, 0.8, {ease: FlxEase.sineIn});
|
||||
FlxTween.tween(scrollLower.velocity, {x: 0}, 0.8, {ease: FlxEase.sineIn});
|
||||
FlxTween.tween(scrollTop.velocity, {x: 0}, 0.8, {ease: FlxEase.sineIn});
|
||||
FlxTween.tween(scrollMiddle.velocity, {x: 0}, 0.8, {ease: FlxEase.sineIn});
|
||||
}
|
||||
|
||||
public override function applyExitMovers(?exitMovers:FreeplayState.ExitMoverData, ?exitMoversCharSel:FreeplayState.ExitMoverData):Void
|
||||
{
|
||||
super.applyExitMovers(exitMovers, exitMoversCharSel);
|
||||
if (exitMovers == null || exitMoversCharSel == null) return;
|
||||
|
||||
exitMoversCharSel.set([scrollTop],
|
||||
{
|
||||
y: -90,
|
||||
speed: 0.8,
|
||||
wait: 0.1
|
||||
});
|
||||
|
||||
exitMoversCharSel.set([scrollMiddle],
|
||||
{
|
||||
y: -80,
|
||||
speed: 0.8,
|
||||
wait: 0.1
|
||||
});
|
||||
|
||||
exitMoversCharSel.set([blueBar],
|
||||
{
|
||||
y: -70,
|
||||
speed: 0.8,
|
||||
wait: 0.1
|
||||
});
|
||||
|
||||
exitMoversCharSel.set([scrollLower],
|
||||
{
|
||||
y: -60,
|
||||
speed: 0.8,
|
||||
wait: 0.1
|
||||
});
|
||||
|
||||
exitMoversCharSel.set([scrollBack],
|
||||
{
|
||||
y: -50,
|
||||
speed: 0.8,
|
||||
wait: 0.1
|
||||
});
|
||||
}
|
||||
|
||||
public override function init():Void
|
||||
{
|
||||
FlxTween.tween(pinkBack, {x: 0}, 0.6, {ease: FlxEase.quartOut});
|
||||
add(pinkBack);
|
||||
|
||||
// add(orangeBackShit);
|
||||
|
||||
// add(alsoOrangeLOL);
|
||||
|
||||
// FlxSpriteUtil.alphaMaskFlxSprite(orangeBackShit, pinkBack, orangeBackShit);
|
||||
// orangeBackShit.visible = false;
|
||||
// alsoOrangeLOL.visible = false;
|
||||
|
||||
confirmTextGlow.blend = BlendMode.ADD;
|
||||
confirmTextGlow.visible = false;
|
||||
|
||||
|
@ -48,27 +102,213 @@ class PicoCard extends BackingCard
|
|||
confirmGlow.visible = false;
|
||||
confirmGlow2.visible = false;
|
||||
|
||||
add(confirmGlow2);
|
||||
add(confirmGlow);
|
||||
scrollBack = new FlxBackdrop(Paths.image('freeplay/backingCards/pico/lowerLoop'), X, 20);
|
||||
scrollBack.setPosition(0, 200);
|
||||
scrollBack.flipX = true;
|
||||
scrollBack.alpha = 0.39;
|
||||
scrollBack.velocity.x = 110;
|
||||
add(scrollBack);
|
||||
|
||||
add(confirmTextGlow);
|
||||
scrollLower = new FlxBackdrop(Paths.image('freeplay/backingCards/pico/lowerLoop'), X, 20);
|
||||
scrollLower.setPosition(0, 406);
|
||||
scrollLower.velocity.x = -110;
|
||||
add(scrollLower);
|
||||
|
||||
add(backingTextYeah);
|
||||
blueBar = new FlxSprite(0, 239).loadGraphic(Paths.image('freeplay/backingCards/pico/blueBar'));
|
||||
blueBar.blend = BlendMode.MULTIPLY;
|
||||
blueBar.alpha = 0.4;
|
||||
add(blueBar);
|
||||
|
||||
scrollTop = new FlxBackdrop(null, X, 20);
|
||||
scrollTop.setPosition(0, 80);
|
||||
scrollTop.velocity.x = -220;
|
||||
|
||||
scrollTop.frames = Paths.getSparrowAtlas('freeplay/backingCards/pico/topLoop');
|
||||
scrollTop.animation.addByPrefix('uzi', 'uzi info', 24, false);
|
||||
scrollTop.animation.addByPrefix('sniper', 'sniper info', 24, false);
|
||||
scrollTop.animation.addByPrefix('rocket launcher', 'rocket launcher info', 24, false);
|
||||
scrollTop.animation.addByPrefix('rifle', 'rifle info', 24, false);
|
||||
scrollTop.animation.addByPrefix('base', 'base', 24, false);
|
||||
scrollTop.animation.play('base');
|
||||
|
||||
add(scrollTop);
|
||||
|
||||
scrollMiddle = new FlxBackdrop(Paths.image('freeplay/backingCards/pico/middleLoop'), X, 15);
|
||||
scrollMiddle.setPosition(0, 346);
|
||||
add(scrollMiddle);
|
||||
scrollMiddle.velocity.x = 220;
|
||||
|
||||
glowDark = new FlxSprite(-300, 330).loadGraphic(Paths.image('freeplay/backingCards/pico/glow'));
|
||||
glowDark.blend = BlendMode.MULTIPLY;
|
||||
add(glowDark);
|
||||
|
||||
glow = new FlxSprite(-300, 330).loadGraphic(Paths.image('freeplay/backingCards/pico/glow'));
|
||||
glow.blend = BlendMode.ADD;
|
||||
add(glow);
|
||||
|
||||
blueBar.visible = false;
|
||||
scrollBack.visible = false;
|
||||
scrollLower.visible = false;
|
||||
scrollTop.visible = false;
|
||||
scrollMiddle.visible = false;
|
||||
glow.visible = false;
|
||||
glowDark.visible = false;
|
||||
|
||||
confirmAtlas = new FlxAtlasSprite(5, 55, Paths.animateAtlas("freeplay/backingCards/pico/pico-confirm"));
|
||||
confirmAtlas.visible = false;
|
||||
add(confirmAtlas);
|
||||
|
||||
cardGlow.blend = BlendMode.ADD;
|
||||
cardGlow.visible = false;
|
||||
|
||||
add(cardGlow);
|
||||
}
|
||||
|
||||
public override function applyStyle(_freeplayState:FreeplayState):Void {}
|
||||
override public function confirm():Void
|
||||
{
|
||||
confirmAtlas.visible = true;
|
||||
confirmAtlas.anim.play("");
|
||||
|
||||
FlxTween.color(instance.bgDad, 10 / 24, 0xFFFFFFFF, 0xFF8A8A8A,
|
||||
{
|
||||
ease: FlxEase.expoOut,
|
||||
onUpdate: function(_) {
|
||||
instance.angleMaskShader.extraColor = instance.bgDad.color;
|
||||
}
|
||||
});
|
||||
|
||||
new FlxTimer().start(10 / 24, function(_) {
|
||||
// shoot
|
||||
FlxTween.color(instance.bgDad, 3 / 24, 0xFF343036, 0xFF696366,
|
||||
{
|
||||
ease: FlxEase.expoOut,
|
||||
onUpdate: function(_) {
|
||||
instance.angleMaskShader.extraColor = instance.bgDad.color;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
new FlxTimer().start(14 / 24, function(_) {
|
||||
// shoot
|
||||
FlxTween.color(instance.bgDad, 3 / 24, 0xFF27292D, 0xFF686A6F,
|
||||
{
|
||||
ease: FlxEase.expoOut,
|
||||
onUpdate: function(_) {
|
||||
instance.angleMaskShader.extraColor = instance.bgDad.color;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
new FlxTimer().start(18 / 24, function(_) {
|
||||
// shoot
|
||||
FlxTween.color(instance.bgDad, 3 / 24, 0xFF2D282D, 0xFF676164,
|
||||
{
|
||||
ease: FlxEase.expoOut,
|
||||
onUpdate: function(_) {
|
||||
instance.angleMaskShader.extraColor = instance.bgDad.color;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
new FlxTimer().start(21 / 24, function(_) {
|
||||
// shoot
|
||||
FlxTween.color(instance.bgDad, 3 / 24, 0xFF29292F, 0xFF62626B,
|
||||
{
|
||||
ease: FlxEase.expoOut,
|
||||
onUpdate: function(_) {
|
||||
instance.angleMaskShader.extraColor = instance.bgDad.color;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
new FlxTimer().start(24 / 24, function(_) {
|
||||
// shoot
|
||||
FlxTween.color(instance.bgDad, 3 / 24, 0xFF29232C, 0xFF808080,
|
||||
{
|
||||
ease: FlxEase.expoOut,
|
||||
onUpdate: function(_) {
|
||||
instance.angleMaskShader.extraColor = instance.bgDad.color;
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
var beatFreq:Int = 1;
|
||||
var beatFreqList:Array<Int> = [1,2,4,8];
|
||||
|
||||
public override function beatHit():Void {
|
||||
// increases the amount of beats that need to go by to pulse the glow because itd flash like craazy at high bpms.....
|
||||
beatFreq = beatFreqList[Math.floor(Conductor.instance.bpm/140)];
|
||||
|
||||
if(Conductor.instance.currentBeat % beatFreq != 0) return;
|
||||
FlxTween.cancelTweensOf(glow);
|
||||
FlxTween.cancelTweensOf(glowDark);
|
||||
|
||||
glow.alpha = 1;
|
||||
FlxTween.tween(glow, {alpha: 0}, 16/24, {ease: FlxEase.quartOut});
|
||||
glowDark.alpha = 0;
|
||||
FlxTween.tween(glowDark, {alpha: 1}, 18/24, {ease: FlxEase.quartOut});
|
||||
}
|
||||
|
||||
public override function introDone():Void
|
||||
{
|
||||
pinkBack.color = 0xFF98A2F3;
|
||||
// orangeBackShit.visible = true;
|
||||
// alsoOrangeLOL.visible = true;
|
||||
|
||||
blueBar.visible = true;
|
||||
scrollBack.visible = true;
|
||||
scrollLower.visible = true;
|
||||
scrollTop.visible = true;
|
||||
scrollMiddle.visible = true;
|
||||
glowDark.visible = true;
|
||||
glow.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 disappear():Void
|
||||
{
|
||||
FlxTween.color(pinkBack, 0.25, 0xFF98A2F3, 0xFFFFD0D5, {ease: FlxEase.quadOut});
|
||||
|
||||
blueBar.visible = false;
|
||||
scrollBack.visible = false;
|
||||
scrollLower.visible = false;
|
||||
scrollTop.visible = false;
|
||||
scrollMiddle.visible = false;
|
||||
glowDark.visible = false;
|
||||
glow.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 update(elapsed:Float):Void
|
||||
{
|
||||
super.update(elapsed);
|
||||
var scrollProgress:Float = Math.abs(scrollTop.x % (scrollTop.frameWidth + 20));
|
||||
|
||||
if (scrollTop.animation.curAnim.finished == true)
|
||||
{
|
||||
if (FlxMath.inBounds(scrollProgress, 500, 700) && scrollTop.animation.curAnim.name != 'sniper')
|
||||
{
|
||||
scrollTop.animation.play('sniper', true, false);
|
||||
}
|
||||
|
||||
if (FlxMath.inBounds(scrollProgress, 700, 1300) && scrollTop.animation.curAnim.name != 'rifle')
|
||||
{
|
||||
scrollTop.animation.play('rifle', true, false);
|
||||
}
|
||||
|
||||
if (FlxMath.inBounds(scrollProgress, 1450, 2000) && scrollTop.animation.curAnim.name != 'rocket launcher')
|
||||
{
|
||||
scrollTop.animation.play('rocket launcher', true, false);
|
||||
}
|
||||
|
||||
if (FlxMath.inBounds(scrollProgress, 0, 300) && scrollTop.animation.curAnim.name != 'uzi')
|
||||
{
|
||||
scrollTop.animation.play('uzi', true, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue