mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2024-11-15 03:13:45 +00:00
Swappable album art and updated FlxAnimate
This commit is contained in:
parent
7a653707a8
commit
2ae6882241
2
assets
2
assets
|
@ -1 +1 @@
|
|||
Subproject commit 4e409880a2e25357ba755e816e237519d6d6adfb
|
||||
Subproject commit 902b12a0cdd9b588cefe573e591530f088a77b4c
|
4
hmm.json
4
hmm.json
|
@ -37,8 +37,8 @@
|
|||
"name": "flxanimate",
|
||||
"type": "git",
|
||||
"dir": null,
|
||||
"ref": "17e0d59fdbc2b6283a5c0e4df41f1c7f27b71c49",
|
||||
"url": "https://github.com/FunkinCrew/flxanimate"
|
||||
"ref": "768740a56b26aa0c072720e0d1236b94afe68e3e",
|
||||
"url": "https://github.com/Dot-Stuff/flxanimate"
|
||||
},
|
||||
{
|
||||
"name": "FlxPartialSound",
|
||||
|
|
|
@ -241,11 +241,11 @@ class InitState extends FlxState
|
|||
totalNotesHit: 140,
|
||||
totalNotes: 190
|
||||
}
|
||||
// 2000 = loss
|
||||
// 240 = good
|
||||
// 230 = great
|
||||
// 210 = excellent
|
||||
// 190 = perfect
|
||||
// 2400 total notes = 7% = LOSS
|
||||
// 240 total notes = 79% = GOOD
|
||||
// 230 total notes = 82% = GREAT
|
||||
// 210 total notes = 91% = EXCELLENT
|
||||
// 190 total notes = PERFECT
|
||||
},
|
||||
}));
|
||||
#elseif ANIMDEBUG
|
||||
|
|
|
@ -58,8 +58,9 @@ class PlayerRegistry extends BaseRegistry<PlayableCharacter, PlayerData>
|
|||
* @param characterId The stage character ID.
|
||||
* @return The playable character.
|
||||
*/
|
||||
public function getCharacterOwnerId(characterId:String):Null<String>
|
||||
public function getCharacterOwnerId(characterId:Null<String>):Null<String>
|
||||
{
|
||||
if (characterId == null) return null;
|
||||
return ownedCharacterIds[characterId];
|
||||
}
|
||||
|
||||
|
|
|
@ -4,8 +4,11 @@ import flixel.util.FlxSignal.FlxTypedSignal;
|
|||
import flxanimate.FlxAnimate;
|
||||
import flxanimate.FlxAnimate.Settings;
|
||||
import flxanimate.frames.FlxAnimateFrames;
|
||||
import flixel.graphics.frames.FlxFrame;
|
||||
import flixel.system.FlxAssets.FlxGraphicAsset;
|
||||
import openfl.display.BitmapData;
|
||||
import openfl.utils.Assets;
|
||||
import flixel.math.FlxPoint;
|
||||
|
||||
/**
|
||||
* A sprite which provides convenience functions for rendering a texture atlas with animations.
|
||||
|
@ -25,9 +28,19 @@ class FlxAtlasSprite extends FlxAnimate
|
|||
};
|
||||
|
||||
/**
|
||||
* Signal dispatched when an animation finishes playing.
|
||||
* Signal dispatched when an animation advances to the next frame.
|
||||
*/
|
||||
public var onAnimationFinish:FlxTypedSignal<String->Void> = new FlxTypedSignal<String->Void>();
|
||||
public var onAnimationFrame:FlxTypedSignal<String->Int->Void> = new FlxTypedSignal();
|
||||
|
||||
/**
|
||||
* Signal dispatched when a non-looping animation finishes playing.
|
||||
*/
|
||||
public var onAnimationComplete:FlxTypedSignal<String->Void> = new FlxTypedSignal();
|
||||
|
||||
/**
|
||||
* Signal dispatched when a looping animation finishes playing
|
||||
*/
|
||||
public var onAnimationLoopComplete:FlxTypedSignal<String->Void> = new FlxTypedSignal();
|
||||
|
||||
var currentAnimation:String;
|
||||
|
||||
|
@ -44,17 +57,20 @@ class FlxAtlasSprite extends FlxAnimate
|
|||
|
||||
super(x, y, path, settings);
|
||||
|
||||
if (this.anim.curInstance == null)
|
||||
if (this.anim.stageInstance == null)
|
||||
{
|
||||
throw 'FlxAtlasSprite not initialized properly. Are you sure the path (${path}) exists?';
|
||||
}
|
||||
|
||||
onAnimationFinish.add(cleanupAnimation);
|
||||
onAnimationComplete.add(cleanupAnimation);
|
||||
|
||||
// This defaults the sprite to play the first animation in the atlas,
|
||||
// then pauses it. This ensures symbols are intialized properly.
|
||||
this.anim.play('');
|
||||
this.anim.pause();
|
||||
|
||||
this.anim.onComplete.add(_onAnimationComplete);
|
||||
this.anim.onFrame.add(_onAnimationFrame);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -62,9 +78,13 @@ class FlxAtlasSprite extends FlxAnimate
|
|||
*/
|
||||
public function listAnimations():Array<String>
|
||||
{
|
||||
if (this.anim == null) return [];
|
||||
return this.anim.getFrameLabels();
|
||||
// return [""];
|
||||
var mainSymbol = this.anim.symbolDictionary[this.anim.stageInstance.symbol.name];
|
||||
if (mainSymbol == null)
|
||||
{
|
||||
FlxG.log.error('FlxAtlasSprite does not have its main symbol!');
|
||||
return [];
|
||||
}
|
||||
return mainSymbol.getFrameLabels().map(keyFrame -> keyFrame.name).filterNull();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -107,12 +127,11 @@ class FlxAtlasSprite extends FlxAnimate
|
|||
* @param restart Whether to restart the animation if it is already playing.
|
||||
* @param ignoreOther Whether to ignore all other animation inputs, until this one is done playing
|
||||
* @param loop Whether to loop the animation
|
||||
* @param startFrame The frame to start the animation on
|
||||
* NOTE: `loop` and `ignoreOther` are not compatible with each other!
|
||||
*/
|
||||
public function playAnimation(id:String, restart:Bool = false, ignoreOther:Bool = false, ?loop:Bool = false):Void
|
||||
public function playAnimation(id:String, restart:Bool = false, ignoreOther:Bool = false, loop:Bool = false, startFrame:Int = 0):Void
|
||||
{
|
||||
if (loop == null) loop = false;
|
||||
|
||||
// Skip if not allowed to play animations.
|
||||
if ((!canPlayOtherAnims && !ignoreOther)) return;
|
||||
|
||||
|
@ -128,7 +147,7 @@ class FlxAtlasSprite extends FlxAnimate
|
|||
else
|
||||
{
|
||||
// Resume animation if it's paused.
|
||||
anim.play('', false, false);
|
||||
anim.play('', restart, false, startFrame);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -141,31 +160,27 @@ class FlxAtlasSprite extends FlxAnimate
|
|||
}
|
||||
}
|
||||
|
||||
anim.callback = function(_, frame:Int) {
|
||||
var offset = loop ? 0 : -1;
|
||||
|
||||
var frameLabel = anim.getFrameLabel(id);
|
||||
if (frame == (frameLabel.duration + offset) + frameLabel.index)
|
||||
anim.onComplete.removeAll();
|
||||
anim.onComplete.add(function() {
|
||||
if (loop)
|
||||
{
|
||||
if (loop)
|
||||
{
|
||||
playAnimation(id, true, false, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
onAnimationFinish.dispatch(id);
|
||||
}
|
||||
onAnimationLoopComplete.dispatch(id);
|
||||
this.anim.play(id, restart, false, startFrame);
|
||||
this.currentAnimation = id;
|
||||
}
|
||||
};
|
||||
|
||||
anim.onComplete = function() {
|
||||
onAnimationFinish.dispatch(id);
|
||||
};
|
||||
else
|
||||
{
|
||||
onAnimationComplete.dispatch(id);
|
||||
}
|
||||
});
|
||||
|
||||
// Prevent other animations from playing if `ignoreOther` is true.
|
||||
if (ignoreOther) canPlayOtherAnims = false;
|
||||
|
||||
// Move to the first frame of the animation.
|
||||
// goToFrameLabel(id);
|
||||
trace('Playing animation $id');
|
||||
this.anim.play(id, restart, false, startFrame);
|
||||
goToFrameLabel(id);
|
||||
this.currentAnimation = id;
|
||||
}
|
||||
|
@ -175,6 +190,24 @@ class FlxAtlasSprite extends FlxAnimate
|
|||
super.update(elapsed);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the animation has finished playing.
|
||||
* Never true if animation is configured to loop.
|
||||
*/
|
||||
public function isAnimationFinished():Bool
|
||||
{
|
||||
return this.anim.finished;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the animation has reached the last frame.
|
||||
* Can be true even if animation is configured to loop.
|
||||
*/
|
||||
public function isLoopComplete():Bool
|
||||
{
|
||||
return (anim.reversed && anim.curFrame == 0 || !(anim.reversed) && (anim.curFrame) >= (anim.length - 1));
|
||||
}
|
||||
|
||||
/**
|
||||
* Stops the current animation.
|
||||
*/
|
||||
|
@ -219,4 +252,76 @@ class FlxAtlasSprite extends FlxAnimate
|
|||
// this.currentAnimation = null;
|
||||
this.anim.pause();
|
||||
}
|
||||
|
||||
function _onAnimationFrame(frame:Int):Void
|
||||
{
|
||||
if (currentAnimation != null)
|
||||
{
|
||||
onAnimationFrame.dispatch(currentAnimation, frame);
|
||||
if (isLoopComplete()) onAnimationLoopComplete.dispatch(currentAnimation);
|
||||
}
|
||||
}
|
||||
|
||||
function _onAnimationComplete():Void
|
||||
{
|
||||
if (currentAnimation != null)
|
||||
{
|
||||
onAnimationComplete.dispatch(currentAnimation);
|
||||
}
|
||||
}
|
||||
|
||||
var prevFrames:Map<Int, FlxFrame> = [];
|
||||
|
||||
public function replaceFrameGraphic(index:Int, ?graphic:FlxGraphicAsset):Void
|
||||
{
|
||||
if (graphic == null || !Assets.exists(graphic))
|
||||
{
|
||||
var prevFrame:Null<FlxFrame> = prevFrames.get(index);
|
||||
if (prevFrame == null) return;
|
||||
|
||||
prevFrame.copyTo(frames.getByIndex(index));
|
||||
return;
|
||||
}
|
||||
|
||||
var prevFrame:FlxFrame = prevFrames.get(index) ?? frames.getByIndex(index).copyTo();
|
||||
prevFrames.set(index, prevFrame);
|
||||
|
||||
var frame = FlxG.bitmap.add(graphic).imageFrame.frame;
|
||||
frame.copyTo(frames.getByIndex(index));
|
||||
|
||||
// Additional sizing fix.
|
||||
@:privateAccess
|
||||
if (true)
|
||||
{
|
||||
var frame = frames.getByIndex(index);
|
||||
frame.tileMatrix[0] = prevFrame.frame.width / frame.frame.width;
|
||||
frame.tileMatrix[3] = prevFrame.frame.height / frame.frame.height;
|
||||
}
|
||||
}
|
||||
|
||||
public function getBasePosition():Null<FlxPoint>
|
||||
{
|
||||
var stagePos = new FlxPoint(anim.stageInstance.matrix.tx, anim.stageInstance.matrix.ty);
|
||||
var instancePos = new FlxPoint(anim.curInstance.matrix.tx, anim.curInstance.matrix.ty);
|
||||
var firstElement = anim.curSymbol.timeline?.get(0)?.get(0)?.get(0);
|
||||
if (firstElement == null) return instancePos;
|
||||
var firstElementPos = new FlxPoint(firstElement.matrix.tx, firstElement.matrix.ty);
|
||||
|
||||
return instancePos + firstElementPos;
|
||||
}
|
||||
|
||||
public function getPivotPosition():Null<FlxPoint>
|
||||
{
|
||||
return anim.curInstance.symbol.transformationPoint;
|
||||
}
|
||||
|
||||
public override function destroy():Void
|
||||
{
|
||||
for (prevFrameId in prevFrames.keys())
|
||||
{
|
||||
replaceFrameGraphic(prevFrameId, null);
|
||||
}
|
||||
|
||||
super.destroy();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -70,6 +70,8 @@ class ResultState extends MusicBeatSubState
|
|||
delay:Float
|
||||
}> = [];
|
||||
|
||||
var playerCharacterId:Null<String>;
|
||||
|
||||
var rankBg:FunkinSprite;
|
||||
final cameraBG:FunkinCamera;
|
||||
final cameraScroll:FunkinCamera;
|
||||
|
@ -164,7 +166,7 @@ class ResultState extends MusicBeatSubState
|
|||
add(soundSystem);
|
||||
|
||||
// Fetch playable character data. Default to BF on the results screen if we can't find it.
|
||||
var playerCharacterId:Null<String> = PlayerRegistry.instance.getCharacterOwnerId(params.characterId);
|
||||
playerCharacterId = PlayerRegistry.instance.getCharacterOwnerId(params.characterId);
|
||||
var playerCharacter:Null<PlayableCharacter> = PlayerRegistry.instance.fetchEntry(playerCharacterId ?? 'bf');
|
||||
|
||||
trace('Got playable character: ${playerCharacter?.getName()}');
|
||||
|
@ -189,7 +191,7 @@ class ResultState extends MusicBeatSubState
|
|||
if (!(animData.looped ?? true))
|
||||
{
|
||||
// Animation is not looped.
|
||||
animation.onAnimationFinish.add((_name:String) -> {
|
||||
animation.onAnimationComplete.add((_name:String) -> {
|
||||
if (animation != null)
|
||||
{
|
||||
animation.anim.pause();
|
||||
|
@ -198,7 +200,7 @@ class ResultState extends MusicBeatSubState
|
|||
}
|
||||
else if (animData.loopFrameLabel != null)
|
||||
{
|
||||
animation.onAnimationFinish.add((_name:String) -> {
|
||||
animation.onAnimationComplete.add((_name:String) -> {
|
||||
if (animation != null)
|
||||
{
|
||||
animation.playAnimation(animData.loopFrameLabel ?? ''); // unpauses this anim, since it's on PlayOnce!
|
||||
|
@ -207,7 +209,7 @@ class ResultState extends MusicBeatSubState
|
|||
}
|
||||
else if (animData.loopFrame != null)
|
||||
{
|
||||
animation.onAnimationFinish.add((_name:String) -> {
|
||||
animation.onAnimationComplete.add((_name:String) -> {
|
||||
if (animation != null)
|
||||
{
|
||||
animation.anim.curFrame = animData.loopFrame ?? 0;
|
||||
|
@ -742,6 +744,7 @@ class ResultState extends MusicBeatSubState
|
|||
FlxG.switchState(FreeplayState.build(
|
||||
{
|
||||
{
|
||||
character: playerCharacterId ?? "bf",
|
||||
fromResults:
|
||||
{
|
||||
oldRank: Scoring.calculateRank(params?.prevScoreData),
|
||||
|
@ -799,8 +802,9 @@ typedef ResultsStateParams =
|
|||
|
||||
/**
|
||||
* The character ID for the song we just played.
|
||||
* @default `bf`
|
||||
*/
|
||||
var characterId:String;
|
||||
var ?characterId:String;
|
||||
|
||||
/**
|
||||
* Whether the displayed score is a new highscore
|
||||
|
|
|
@ -109,8 +109,6 @@ class AnimateAtlasCharacter extends BaseCharacter
|
|||
var loop:Bool = animData.looped;
|
||||
|
||||
this.mainSprite.playAnimation(prefix, restart, ignoreOther, loop);
|
||||
|
||||
animFinished = false;
|
||||
}
|
||||
|
||||
public override function hasAnimation(name:String):Bool
|
||||
|
@ -124,7 +122,7 @@ class AnimateAtlasCharacter extends BaseCharacter
|
|||
*/
|
||||
public override function isAnimationFinished():Bool
|
||||
{
|
||||
return animFinished;
|
||||
return mainSprite.isAnimationFinished();
|
||||
}
|
||||
|
||||
function loadAtlasSprite():FlxAtlasSprite
|
||||
|
@ -133,8 +131,8 @@ class AnimateAtlasCharacter extends BaseCharacter
|
|||
|
||||
var sprite:FlxAtlasSprite = new FlxAtlasSprite(0, 0, Paths.animateAtlas(_data.assetPath, 'shared'));
|
||||
|
||||
sprite.onAnimationFinish.removeAll();
|
||||
sprite.onAnimationFinish.add(this.onAnimationFinished);
|
||||
// sprite.onAnimationComplete.removeAll();
|
||||
sprite.onAnimationComplete.add(this.onAnimationFinished);
|
||||
|
||||
return sprite;
|
||||
}
|
||||
|
@ -152,7 +150,6 @@ class AnimateAtlasCharacter extends BaseCharacter
|
|||
// Make the game hold on the last frame.
|
||||
this.mainSprite.cleanupAnimation(prefix);
|
||||
// currentAnimName = null;
|
||||
animFinished = true;
|
||||
|
||||
// Fallback to idle!
|
||||
// playAnimation('idle', true, false);
|
||||
|
@ -165,6 +162,11 @@ class AnimateAtlasCharacter extends BaseCharacter
|
|||
|
||||
this.mainSprite = sprite;
|
||||
|
||||
// This forces the atlas to recalcuate its width and height
|
||||
this.mainSprite.alpha = 0.0001;
|
||||
this.mainSprite.draw();
|
||||
this.mainSprite.alpha = 1.0;
|
||||
|
||||
var feetPos:FlxPoint = feetPosition;
|
||||
this.updateHitbox();
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ class CharSelectPlayer extends FlxAtlasSprite
|
|||
{
|
||||
super(x, y, Paths.animateAtlas("charSelect/bfChill"));
|
||||
|
||||
onAnimationFinish.add(function(animLabel:String) {
|
||||
onAnimationComplete.add(function(animLabel:String) {
|
||||
switch (animLabel)
|
||||
{
|
||||
case "slidein":
|
||||
|
|
|
@ -600,7 +600,7 @@ class CharSelectSubState extends MusicBeatSubState
|
|||
playerChill.visible = false;
|
||||
playerChillOut.visible = true;
|
||||
playerChillOut.anim.goToFrameLabel("slideout");
|
||||
playerChillOut.anim.callback = (_, frame:Int) -> {
|
||||
playerChillOut.onAnimationFrame.add((_, frame:Int) -> {
|
||||
if (frame == playerChillOut.anim.getFrameLabel("slideout").index + 1)
|
||||
{
|
||||
playerChill.visible = true;
|
||||
|
@ -612,7 +612,7 @@ class CharSelectSubState extends MusicBeatSubState
|
|||
playerChillOut.switchChar(value);
|
||||
playerChillOut.visible = false;
|
||||
}
|
||||
};
|
||||
});
|
||||
return value;
|
||||
}
|
||||
|
||||
|
|
|
@ -37,6 +37,7 @@ class AlbumRoll extends FlxSpriteGroup
|
|||
}
|
||||
|
||||
var newAlbumArt:FlxAtlasSprite;
|
||||
var albumTitle:FunkinSprite;
|
||||
|
||||
var difficultyStars:DifficultyStars;
|
||||
var _exitMovers:Null<FreeplayState.ExitMoverData>;
|
||||
|
@ -59,24 +60,27 @@ class AlbumRoll extends FlxSpriteGroup
|
|||
{
|
||||
super();
|
||||
|
||||
newAlbumArt = new FlxAtlasSprite(0, 0, Paths.animateAtlas("freeplay/albumRoll/freeplayAlbum"));
|
||||
newAlbumArt = new FlxAtlasSprite(640, 350, Paths.animateAtlas("freeplay/albumRoll/freeplayAlbum"));
|
||||
newAlbumArt.visible = false;
|
||||
newAlbumArt.onAnimationFinish.add(onAlbumFinish);
|
||||
newAlbumArt.onAnimationComplete.add(onAlbumFinish);
|
||||
|
||||
add(newAlbumArt);
|
||||
|
||||
difficultyStars = new DifficultyStars(140, 39);
|
||||
difficultyStars.visible = false;
|
||||
add(difficultyStars);
|
||||
|
||||
buildAlbumTitle("freeplay/albumRoll/volume1-text");
|
||||
albumTitle.visible = false;
|
||||
}
|
||||
|
||||
function onAlbumFinish(animName:String):Void
|
||||
{
|
||||
// Play the idle animation for the current album.
|
||||
newAlbumArt.playAnimation(animNames.get('$albumId-idle'), false, false, true);
|
||||
|
||||
// End on the last frame and don't continue until playAnimation is called again.
|
||||
// newAlbumArt.anim.pause();
|
||||
if (animName != "idle")
|
||||
{
|
||||
// newAlbumArt.playAnimation('idle', true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -104,6 +108,12 @@ class AlbumRoll extends FlxSpriteGroup
|
|||
return;
|
||||
};
|
||||
|
||||
// Update the album art.
|
||||
var albumGraphic = Paths.image(albumData.getAlbumArtAssetKey());
|
||||
newAlbumArt.replaceFrameGraphic(0, albumGraphic);
|
||||
|
||||
buildAlbumTitle(albumData.getAlbumTitleAssetKey());
|
||||
|
||||
applyExitMovers();
|
||||
|
||||
refresh();
|
||||
|
@ -146,19 +156,57 @@ class AlbumRoll extends FlxSpriteGroup
|
|||
*/
|
||||
public function playIntro():Void
|
||||
{
|
||||
albumTitle.visible = false;
|
||||
newAlbumArt.visible = true;
|
||||
newAlbumArt.playAnimation(animNames.get('$albumId-active'), false, false, false);
|
||||
newAlbumArt.playAnimation('intro', true);
|
||||
|
||||
difficultyStars.visible = false;
|
||||
new FlxTimer().start(0.75, function(_) {
|
||||
// showTitle();
|
||||
showTitle();
|
||||
showStars();
|
||||
albumTitle.animation.play('switch');
|
||||
});
|
||||
}
|
||||
|
||||
public function skipIntro():Void
|
||||
{
|
||||
newAlbumArt.playAnimation(animNames.get('$albumId-trans'), false, false, false);
|
||||
// Weird workaround
|
||||
newAlbumArt.playAnimation('switch', true);
|
||||
albumTitle.animation.play('switch');
|
||||
}
|
||||
|
||||
public function showTitle():Void
|
||||
{
|
||||
albumTitle.visible = true;
|
||||
}
|
||||
|
||||
public function buildAlbumTitle(assetKey:String):Void
|
||||
{
|
||||
if (albumTitle != null)
|
||||
{
|
||||
remove(albumTitle);
|
||||
albumTitle = null;
|
||||
}
|
||||
|
||||
albumTitle = FunkinSprite.createSparrow(925, 500, assetKey);
|
||||
albumTitle.visible = albumTitle.frames != null && newAlbumArt.visible;
|
||||
albumTitle.animation.addByPrefix('idle', 'idle0', 24, true);
|
||||
albumTitle.animation.addByPrefix('switch', 'switch0', 24, false);
|
||||
add(albumTitle);
|
||||
|
||||
albumTitle.animation.finishCallback = (function(name) {
|
||||
if (name == 'switch') albumTitle.animation.play('idle');
|
||||
});
|
||||
albumTitle.animation.play('idle');
|
||||
|
||||
albumTitle.zIndex = 1000;
|
||||
|
||||
if (_exitMovers != null) _exitMovers.set([albumTitle],
|
||||
{
|
||||
x: FlxG.width,
|
||||
speed: 0.4,
|
||||
wait: 0
|
||||
});
|
||||
}
|
||||
|
||||
public function setDifficultyStars(?difficulty:Int):Void
|
||||
|
|
|
@ -43,7 +43,7 @@ class FreeplayDJ extends FlxAtlasSprite
|
|||
|
||||
super(x, y, playableCharData.getAtlasPath());
|
||||
|
||||
anim.callback = function(name, number) {
|
||||
onAnimationFrame.add(function(name, number) {
|
||||
if (name == playableCharData.getAnimationPrefix('cartoon'))
|
||||
{
|
||||
if (number == playableCharData.getCartoonSoundClickFrame())
|
||||
|
@ -55,12 +55,12 @@ class FreeplayDJ extends FlxAtlasSprite
|
|||
runTvLogic();
|
||||
}
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
FlxG.debugger.track(this);
|
||||
FlxG.console.registerObject("dj", this);
|
||||
|
||||
anim.onComplete = onFinishAnim;
|
||||
onAnimationComplete.add(onFinishAnim);
|
||||
|
||||
FlxG.console.registerFunction("freeplayCartoon", function() {
|
||||
currentState = Cartoon;
|
||||
|
@ -96,7 +96,7 @@ class FreeplayDJ extends FlxAtlasSprite
|
|||
var animPrefix = playableCharData.getAnimationPrefix('idle');
|
||||
if (getCurrentAnimation() != animPrefix)
|
||||
{
|
||||
playFlashAnimation(animPrefix, true);
|
||||
playFlashAnimation(animPrefix, true, false, true);
|
||||
}
|
||||
|
||||
if (getCurrentAnimation() == animPrefix && this.isLoopFinished())
|
||||
|
@ -120,7 +120,7 @@ class FreeplayDJ extends FlxAtlasSprite
|
|||
if (getCurrentAnimation() != animPrefix) playFlashAnimation('Boyfriend DJ fist pump', false);
|
||||
if (getCurrentAnimation() == animPrefix && anim.curFrame >= 4)
|
||||
{
|
||||
anim.play("Boyfriend DJ fist pump", true, false, 0);
|
||||
playAnimation("Boyfriend DJ fist pump", true, false, false, 0);
|
||||
}
|
||||
case FistPump:
|
||||
|
||||
|
@ -135,9 +135,12 @@ class FreeplayDJ extends FlxAtlasSprite
|
|||
timeIdling = 0;
|
||||
case Cartoon:
|
||||
var animPrefix = playableCharData.getAnimationPrefix('cartoon');
|
||||
if (animPrefix == null) {
|
||||
if (animPrefix == null)
|
||||
{
|
||||
currentState = IdleEasterEgg;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
if (getCurrentAnimation() != animPrefix) playFlashAnimation(animPrefix, true);
|
||||
timeIdling = 0;
|
||||
}
|
||||
|
@ -145,6 +148,7 @@ class FreeplayDJ extends FlxAtlasSprite
|
|||
// I shit myself.
|
||||
}
|
||||
|
||||
#if debug
|
||||
if (FlxG.keys.pressed.CONTROL)
|
||||
{
|
||||
if (FlxG.keys.justPressed.LEFT)
|
||||
|
@ -167,16 +171,17 @@ class FreeplayDJ extends FlxAtlasSprite
|
|||
this.offsetY += FlxG.keys.pressed.ALT ? 0.1 : (FlxG.keys.pressed.SHIFT ? 10.0 : 1.0);
|
||||
}
|
||||
|
||||
if (FlxG.keys.justPressed.SPACE)
|
||||
if (FlxG.keys.justPressed.C)
|
||||
{
|
||||
currentState = (currentState == Idle ? Cartoon : Idle);
|
||||
}
|
||||
}
|
||||
#end
|
||||
}
|
||||
|
||||
function onFinishAnim():Void
|
||||
function onFinishAnim(name:String):Void
|
||||
{
|
||||
var name = anim.curSymbol.name;
|
||||
// var name = anim.curSymbol.name;
|
||||
|
||||
if (name == playableCharData.getAnimationPrefix('intro'))
|
||||
{
|
||||
|
@ -220,7 +225,7 @@ class FreeplayDJ extends FlxAtlasSprite
|
|||
// runTvLogic();
|
||||
}
|
||||
trace('Replay idle: ${frame}');
|
||||
anim.play(playableCharData.getAnimationPrefix('cartoon'), true, false, frame);
|
||||
playAnimation(playableCharData.getAnimationPrefix('cartoon'), true, false, false, frame);
|
||||
// trace('Finished confirm');
|
||||
}
|
||||
else
|
||||
|
@ -266,7 +271,7 @@ class FreeplayDJ extends FlxAtlasSprite
|
|||
function loadCartoon()
|
||||
{
|
||||
cartoonSnd = FunkinSound.load(Paths.sound(getRandomFlashToon()), 1.0, false, true, true, function() {
|
||||
anim.play("Boyfriend DJ watchin tv OG", true, false, 60);
|
||||
playAnimation("Boyfriend DJ watchin tv OG", true, false, false, 60);
|
||||
});
|
||||
|
||||
// Fade out music to 40% volume over 1 second.
|
||||
|
@ -304,13 +309,13 @@ class FreeplayDJ extends FlxAtlasSprite
|
|||
public function pumpFist():Void
|
||||
{
|
||||
currentState = FistPump;
|
||||
anim.play("Boyfriend DJ fist pump", true, false, 4);
|
||||
playAnimation("Boyfriend DJ fist pump", true, false, false, 4);
|
||||
}
|
||||
|
||||
public function pumpFistBad():Void
|
||||
{
|
||||
currentState = FistPump;
|
||||
anim.play("Boyfriend DJ loss reaction 1", true, false, 4);
|
||||
playAnimation("Boyfriend DJ loss reaction 1", true, false, false, 4);
|
||||
}
|
||||
|
||||
override public function getCurrentAnimation():String
|
||||
|
@ -319,9 +324,9 @@ class FreeplayDJ extends FlxAtlasSprite
|
|||
return this.anim.curSymbol.name;
|
||||
}
|
||||
|
||||
public function playFlashAnimation(id:String, ?Force:Bool = false, ?Reverse:Bool = false, ?Frame:Int = 0):Void
|
||||
public function playFlashAnimation(id:String, Force:Bool = false, Reverse:Bool = false, Loop:Bool = false, Frame:Int = 0):Void
|
||||
{
|
||||
anim.play(id, Force, Reverse, Frame);
|
||||
playAnimation(id, Force, Reverse, Loop, Frame);
|
||||
applyAnimOffset();
|
||||
}
|
||||
|
||||
|
|
|
@ -1792,7 +1792,7 @@ class FreeplayState extends MusicBeatSubState
|
|||
confirmGlow.visible = true;
|
||||
confirmGlow2.visible = true;
|
||||
|
||||
backingTextYeah.anim.play("BF back card confirm raw", false, false, 0);
|
||||
backingTextYeah.playAnimation("BF back card confirm raw", false, false, false, 0);
|
||||
confirmGlow2.alpha = 0;
|
||||
confirmGlow.alpha = 0;
|
||||
|
||||
|
|
|
@ -162,7 +162,7 @@ class SongMenuItem extends FlxSpriteGroup
|
|||
|
||||
sparkle = new FlxSprite(ranking.x, ranking.y);
|
||||
sparkle.frames = Paths.getSparrowAtlas('freeplay/sparkle');
|
||||
sparkle.animation.addByPrefix('sparkle', 'sparkle', 24, false);
|
||||
sparkle.animation.addByPrefix('sparkle', 'sparkle Export0', 24, false);
|
||||
sparkle.animation.play('sparkle', true);
|
||||
sparkle.scale.set(0.8, 0.8);
|
||||
sparkle.blend = BlendMode.ADD;
|
||||
|
@ -523,7 +523,6 @@ class SongMenuItem extends FlxSpriteGroup
|
|||
checkWeek(songData?.songId);
|
||||
}
|
||||
|
||||
|
||||
var frameInTicker:Float = 0;
|
||||
var frameInTypeBeat:Int = 0;
|
||||
|
||||
|
|
Loading…
Reference in a new issue