mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2025-04-05 11:34:48 +00:00
Merge branch 'rewrite/master' into 70ltan/char-path-fix
This commit is contained in:
commit
1b309e33ef
artassetshmm.json
source/funkin
2
art
2
art
|
@ -1 +1 @@
|
||||||
Subproject commit faeba700c5526bd4fd57ccc927d875c82b9d3553
|
Subproject commit 55c1b56823d4d7a74397bab9aeab30f15126499c
|
2
assets
2
assets
|
@ -1 +1 @@
|
||||||
Subproject commit 62c4a8203362c1b434de0d376046ebccb96da254
|
Subproject commit 2eac236291775208ce71287a5c27f8f15ae591c9
|
4
hmm.json
4
hmm.json
|
@ -39,8 +39,8 @@
|
||||||
"name": "flxanimate",
|
"name": "flxanimate",
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"dir": null,
|
"dir": null,
|
||||||
"ref": "17e0d59fdbc2b6283a5c0e4df41f1c7f27b71c49",
|
"ref": "768740a56b26aa0c072720e0d1236b94afe68e3e",
|
||||||
"url": "https://github.com/FunkinCrew/flxanimate"
|
"url": "https://github.com/Dot-Stuff/flxanimate"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "FlxPartialSound",
|
"name": "FlxPartialSound",
|
||||||
|
|
|
@ -244,11 +244,11 @@ class InitState extends FlxState
|
||||||
totalNotesHit: 140,
|
totalNotesHit: 140,
|
||||||
totalNotes: 190
|
totalNotes: 190
|
||||||
}
|
}
|
||||||
// 2000 = loss
|
// 2400 total notes = 7% = LOSS
|
||||||
// 240 = good
|
// 240 total notes = 79% = GOOD
|
||||||
// 230 = great
|
// 230 total notes = 82% = GREAT
|
||||||
// 210 = excellent
|
// 210 total notes = 91% = EXCELLENT
|
||||||
// 190 = perfect
|
// 190 total notes = PERFECT
|
||||||
},
|
},
|
||||||
}));
|
}));
|
||||||
#elseif ANIMDEBUG
|
#elseif ANIMDEBUG
|
||||||
|
|
|
@ -58,8 +58,9 @@ class PlayerRegistry extends BaseRegistry<PlayableCharacter, PlayerData>
|
||||||
* @param characterId The stage character ID.
|
* @param characterId The stage character ID.
|
||||||
* @return The playable character.
|
* @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];
|
return ownedCharacterIds[characterId];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -93,8 +93,8 @@ class StageRegistry extends BaseRegistry<Stage, StageData>
|
||||||
public function listBaseGameStageIds():Array<String>
|
public function listBaseGameStageIds():Array<String>
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
"mainStage", "spookyMansion", "phillyTrain", "phillyTrainErect", "limoRide", "limoRideErect", "mallXmas", "mallEvil", "school", "schoolEvil",
|
"mainStage", "mainStageErect", "spookyMansion", "phillyTrain", "phillyTrainErect", "limoRide", "limoRideErect", "mallXmas", "mallEvil", "school",
|
||||||
"tankmanBattlefield", "phillyStreets", "phillyBlazin",
|
"schoolEvil", "tankmanBattlefield", "phillyStreets", "phillyBlazin",
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,8 +4,11 @@ import flixel.util.FlxSignal.FlxTypedSignal;
|
||||||
import flxanimate.FlxAnimate;
|
import flxanimate.FlxAnimate;
|
||||||
import flxanimate.FlxAnimate.Settings;
|
import flxanimate.FlxAnimate.Settings;
|
||||||
import flxanimate.frames.FlxAnimateFrames;
|
import flxanimate.frames.FlxAnimateFrames;
|
||||||
|
import flixel.graphics.frames.FlxFrame;
|
||||||
|
import flixel.system.FlxAssets.FlxGraphicAsset;
|
||||||
import openfl.display.BitmapData;
|
import openfl.display.BitmapData;
|
||||||
import openfl.utils.Assets;
|
import openfl.utils.Assets;
|
||||||
|
import flixel.math.FlxPoint;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A sprite which provides convenience functions for rendering a texture atlas with animations.
|
* 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;
|
var currentAnimation:String;
|
||||||
|
|
||||||
|
@ -44,17 +57,20 @@ class FlxAtlasSprite extends FlxAnimate
|
||||||
|
|
||||||
super(x, y, path, settings);
|
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?';
|
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,
|
// This defaults the sprite to play the first animation in the atlas,
|
||||||
// then pauses it. This ensures symbols are intialized properly.
|
// then pauses it. This ensures symbols are intialized properly.
|
||||||
this.anim.play('');
|
this.anim.play('');
|
||||||
this.anim.pause();
|
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>
|
public function listAnimations():Array<String>
|
||||||
{
|
{
|
||||||
if (this.anim == null) return [];
|
var mainSymbol = this.anim.symbolDictionary[this.anim.stageInstance.symbol.name];
|
||||||
return this.anim.getFrameLabels();
|
if (mainSymbol == null)
|
||||||
// return [""];
|
{
|
||||||
|
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 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 ignoreOther Whether to ignore all other animation inputs, until this one is done playing
|
||||||
* @param loop Whether to loop the animation
|
* @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!
|
* 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.
|
// Skip if not allowed to play animations.
|
||||||
if ((!canPlayOtherAnims && !ignoreOther)) return;
|
if ((!canPlayOtherAnims && !ignoreOther)) return;
|
||||||
|
|
||||||
|
@ -128,7 +147,7 @@ class FlxAtlasSprite extends FlxAnimate
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Resume animation if it's paused.
|
// Resume animation if it's paused.
|
||||||
anim.play('', false, false);
|
anim.play('', restart, false, startFrame);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -141,31 +160,27 @@ class FlxAtlasSprite extends FlxAnimate
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
anim.callback = function(_, frame:Int) {
|
anim.onComplete.removeAll();
|
||||||
var offset = loop ? 0 : -1;
|
anim.onComplete.add(function() {
|
||||||
|
if (loop)
|
||||||
var frameLabel = anim.getFrameLabel(id);
|
|
||||||
if (frame == (frameLabel.duration + offset) + frameLabel.index)
|
|
||||||
{
|
{
|
||||||
if (loop)
|
onAnimationLoopComplete.dispatch(id);
|
||||||
{
|
this.anim.play(id, restart, false, startFrame);
|
||||||
playAnimation(id, true, false, true);
|
this.currentAnimation = id;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
onAnimationFinish.dispatch(id);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
else
|
||||||
|
{
|
||||||
anim.onComplete = function() {
|
onAnimationComplete.dispatch(id);
|
||||||
onAnimationFinish.dispatch(id);
|
}
|
||||||
};
|
});
|
||||||
|
|
||||||
// Prevent other animations from playing if `ignoreOther` is true.
|
// Prevent other animations from playing if `ignoreOther` is true.
|
||||||
if (ignoreOther) canPlayOtherAnims = false;
|
if (ignoreOther) canPlayOtherAnims = false;
|
||||||
|
|
||||||
// Move to the first frame of the animation.
|
// Move to the first frame of the animation.
|
||||||
|
// goToFrameLabel(id);
|
||||||
|
trace('Playing animation $id');
|
||||||
|
this.anim.play(id, restart, false, startFrame);
|
||||||
goToFrameLabel(id);
|
goToFrameLabel(id);
|
||||||
this.currentAnimation = id;
|
this.currentAnimation = id;
|
||||||
}
|
}
|
||||||
|
@ -175,6 +190,24 @@ class FlxAtlasSprite extends FlxAnimate
|
||||||
super.update(elapsed);
|
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.
|
* Stops the current animation.
|
||||||
*/
|
*/
|
||||||
|
@ -219,4 +252,76 @@ class FlxAtlasSprite extends FlxAnimate
|
||||||
// this.currentAnimation = null;
|
// this.currentAnimation = null;
|
||||||
this.anim.pause();
|
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
|
delay:Float
|
||||||
}> = [];
|
}> = [];
|
||||||
|
|
||||||
|
var playerCharacterId:Null<String>;
|
||||||
|
|
||||||
var rankBg:FunkinSprite;
|
var rankBg:FunkinSprite;
|
||||||
final cameraBG:FunkinCamera;
|
final cameraBG:FunkinCamera;
|
||||||
final cameraScroll:FunkinCamera;
|
final cameraScroll:FunkinCamera;
|
||||||
|
@ -164,7 +166,7 @@ class ResultState extends MusicBeatSubState
|
||||||
add(soundSystem);
|
add(soundSystem);
|
||||||
|
|
||||||
// Fetch playable character data. Default to BF on the results screen if we can't find it.
|
// 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');
|
var playerCharacter:Null<PlayableCharacter> = PlayerRegistry.instance.fetchEntry(playerCharacterId ?? 'bf');
|
||||||
|
|
||||||
trace('Got playable character: ${playerCharacter?.getName()}');
|
trace('Got playable character: ${playerCharacter?.getName()}');
|
||||||
|
@ -189,7 +191,7 @@ class ResultState extends MusicBeatSubState
|
||||||
if (!(animData.looped ?? true))
|
if (!(animData.looped ?? true))
|
||||||
{
|
{
|
||||||
// Animation is not looped.
|
// Animation is not looped.
|
||||||
animation.onAnimationFinish.add((_name:String) -> {
|
animation.onAnimationComplete.add((_name:String) -> {
|
||||||
if (animation != null)
|
if (animation != null)
|
||||||
{
|
{
|
||||||
animation.anim.pause();
|
animation.anim.pause();
|
||||||
|
@ -198,7 +200,7 @@ class ResultState extends MusicBeatSubState
|
||||||
}
|
}
|
||||||
else if (animData.loopFrameLabel != null)
|
else if (animData.loopFrameLabel != null)
|
||||||
{
|
{
|
||||||
animation.onAnimationFinish.add((_name:String) -> {
|
animation.onAnimationComplete.add((_name:String) -> {
|
||||||
if (animation != null)
|
if (animation != null)
|
||||||
{
|
{
|
||||||
animation.playAnimation(animData.loopFrameLabel ?? ''); // unpauses this anim, since it's on PlayOnce!
|
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)
|
else if (animData.loopFrame != null)
|
||||||
{
|
{
|
||||||
animation.onAnimationFinish.add((_name:String) -> {
|
animation.onAnimationComplete.add((_name:String) -> {
|
||||||
if (animation != null)
|
if (animation != null)
|
||||||
{
|
{
|
||||||
animation.anim.curFrame = animData.loopFrame ?? 0;
|
animation.anim.curFrame = animData.loopFrame ?? 0;
|
||||||
|
@ -742,6 +744,7 @@ class ResultState extends MusicBeatSubState
|
||||||
FlxG.switchState(FreeplayState.build(
|
FlxG.switchState(FreeplayState.build(
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
|
character: playerCharacterId ?? "bf",
|
||||||
fromResults:
|
fromResults:
|
||||||
{
|
{
|
||||||
oldRank: Scoring.calculateRank(params?.prevScoreData),
|
oldRank: Scoring.calculateRank(params?.prevScoreData),
|
||||||
|
@ -799,8 +802,9 @@ typedef ResultsStateParams =
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The character ID for the song we just played.
|
* 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
|
* Whether the displayed score is a new highscore
|
||||||
|
|
|
@ -109,8 +109,6 @@ class AnimateAtlasCharacter extends BaseCharacter
|
||||||
var loop:Bool = animData.looped;
|
var loop:Bool = animData.looped;
|
||||||
|
|
||||||
this.mainSprite.playAnimation(prefix, restart, ignoreOther, loop);
|
this.mainSprite.playAnimation(prefix, restart, ignoreOther, loop);
|
||||||
|
|
||||||
animFinished = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override function hasAnimation(name:String):Bool
|
public override function hasAnimation(name:String):Bool
|
||||||
|
@ -124,7 +122,7 @@ class AnimateAtlasCharacter extends BaseCharacter
|
||||||
*/
|
*/
|
||||||
public override function isAnimationFinished():Bool
|
public override function isAnimationFinished():Bool
|
||||||
{
|
{
|
||||||
return animFinished;
|
return mainSprite.isAnimationFinished();
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadAtlasSprite():FlxAtlasSprite
|
function loadAtlasSprite():FlxAtlasSprite
|
||||||
|
@ -133,8 +131,8 @@ class AnimateAtlasCharacter extends BaseCharacter
|
||||||
|
|
||||||
var sprite:FlxAtlasSprite = new FlxAtlasSprite(0, 0, Paths.animateAtlas(_data.assetPath));
|
var sprite:FlxAtlasSprite = new FlxAtlasSprite(0, 0, Paths.animateAtlas(_data.assetPath));
|
||||||
|
|
||||||
sprite.onAnimationFinish.removeAll();
|
// sprite.onAnimationComplete.removeAll();
|
||||||
sprite.onAnimationFinish.add(this.onAnimationFinished);
|
sprite.onAnimationComplete.add(this.onAnimationFinished);
|
||||||
|
|
||||||
return sprite;
|
return sprite;
|
||||||
}
|
}
|
||||||
|
@ -152,7 +150,6 @@ class AnimateAtlasCharacter extends BaseCharacter
|
||||||
// Make the game hold on the last frame.
|
// Make the game hold on the last frame.
|
||||||
this.mainSprite.cleanupAnimation(prefix);
|
this.mainSprite.cleanupAnimation(prefix);
|
||||||
// currentAnimName = null;
|
// currentAnimName = null;
|
||||||
animFinished = true;
|
|
||||||
|
|
||||||
// Fallback to idle!
|
// Fallback to idle!
|
||||||
// playAnimation('idle', true, false);
|
// playAnimation('idle', true, false);
|
||||||
|
@ -165,6 +162,11 @@ class AnimateAtlasCharacter extends BaseCharacter
|
||||||
|
|
||||||
this.mainSprite = sprite;
|
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;
|
var feetPos:FlxPoint = feetPosition;
|
||||||
this.updateHitbox();
|
this.updateHitbox();
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ class CharSelectPlayer extends FlxAtlasSprite
|
||||||
{
|
{
|
||||||
super(x, y, Paths.animateAtlas("charSelect/bfChill"));
|
super(x, y, Paths.animateAtlas("charSelect/bfChill"));
|
||||||
|
|
||||||
onAnimationFinish.add(function(animLabel:String) {
|
onAnimationComplete.add(function(animLabel:String) {
|
||||||
switch (animLabel)
|
switch (animLabel)
|
||||||
{
|
{
|
||||||
case "slidein":
|
case "slidein":
|
||||||
|
|
|
@ -600,7 +600,7 @@ class CharSelectSubState extends MusicBeatSubState
|
||||||
playerChill.visible = false;
|
playerChill.visible = false;
|
||||||
playerChillOut.visible = true;
|
playerChillOut.visible = true;
|
||||||
playerChillOut.anim.goToFrameLabel("slideout");
|
playerChillOut.anim.goToFrameLabel("slideout");
|
||||||
playerChillOut.anim.callback = (_, frame:Int) -> {
|
playerChillOut.onAnimationFrame.add((_, frame:Int) -> {
|
||||||
if (frame == playerChillOut.anim.getFrameLabel("slideout").index + 1)
|
if (frame == playerChillOut.anim.getFrameLabel("slideout").index + 1)
|
||||||
{
|
{
|
||||||
playerChill.visible = true;
|
playerChill.visible = true;
|
||||||
|
@ -612,7 +612,7 @@ class CharSelectSubState extends MusicBeatSubState
|
||||||
playerChillOut.switchChar(value);
|
playerChillOut.switchChar(value);
|
||||||
playerChillOut.visible = false;
|
playerChillOut.visible = false;
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5699,7 +5699,7 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
|
||||||
// TODO: Rework asset system so we can remove this jank.
|
// TODO: Rework asset system so we can remove this jank.
|
||||||
switch (currentSongStage)
|
switch (currentSongStage)
|
||||||
{
|
{
|
||||||
case 'mainStage':
|
case 'mainStage' | 'mainStageErect':
|
||||||
PlayStatePlaylist.campaignId = 'week1';
|
PlayStatePlaylist.campaignId = 'week1';
|
||||||
case 'spookyMansion' | 'spookyMansionErect':
|
case 'spookyMansion' | 'spookyMansionErect':
|
||||||
PlayStatePlaylist.campaignId = 'week2';
|
PlayStatePlaylist.campaignId = 'week2';
|
||||||
|
|
|
@ -37,6 +37,7 @@ class AlbumRoll extends FlxSpriteGroup
|
||||||
}
|
}
|
||||||
|
|
||||||
var newAlbumArt:FlxAtlasSprite;
|
var newAlbumArt:FlxAtlasSprite;
|
||||||
|
var albumTitle:FunkinSprite;
|
||||||
|
|
||||||
var difficultyStars:DifficultyStars;
|
var difficultyStars:DifficultyStars;
|
||||||
var _exitMovers:Null<FreeplayState.ExitMoverData>;
|
var _exitMovers:Null<FreeplayState.ExitMoverData>;
|
||||||
|
@ -59,24 +60,27 @@ class AlbumRoll extends FlxSpriteGroup
|
||||||
{
|
{
|
||||||
super();
|
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.visible = false;
|
||||||
newAlbumArt.onAnimationFinish.add(onAlbumFinish);
|
newAlbumArt.onAnimationComplete.add(onAlbumFinish);
|
||||||
|
|
||||||
add(newAlbumArt);
|
add(newAlbumArt);
|
||||||
|
|
||||||
difficultyStars = new DifficultyStars(140, 39);
|
difficultyStars = new DifficultyStars(140, 39);
|
||||||
difficultyStars.visible = false;
|
difficultyStars.visible = false;
|
||||||
add(difficultyStars);
|
add(difficultyStars);
|
||||||
|
|
||||||
|
buildAlbumTitle("freeplay/albumRoll/volume1-text");
|
||||||
|
albumTitle.visible = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function onAlbumFinish(animName:String):Void
|
function onAlbumFinish(animName:String):Void
|
||||||
{
|
{
|
||||||
// Play the idle animation for the current album.
|
// Play the idle animation for the current album.
|
||||||
newAlbumArt.playAnimation(animNames.get('$albumId-idle'), false, false, true);
|
if (animName != "idle")
|
||||||
|
{
|
||||||
// End on the last frame and don't continue until playAnimation is called again.
|
// newAlbumArt.playAnimation('idle', true);
|
||||||
// newAlbumArt.anim.pause();
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -104,6 +108,12 @@ class AlbumRoll extends FlxSpriteGroup
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Update the album art.
|
||||||
|
var albumGraphic = Paths.image(albumData.getAlbumArtAssetKey());
|
||||||
|
newAlbumArt.replaceFrameGraphic(0, albumGraphic);
|
||||||
|
|
||||||
|
buildAlbumTitle(albumData.getAlbumTitleAssetKey());
|
||||||
|
|
||||||
applyExitMovers();
|
applyExitMovers();
|
||||||
|
|
||||||
refresh();
|
refresh();
|
||||||
|
@ -146,19 +156,57 @@ class AlbumRoll extends FlxSpriteGroup
|
||||||
*/
|
*/
|
||||||
public function playIntro():Void
|
public function playIntro():Void
|
||||||
{
|
{
|
||||||
|
albumTitle.visible = false;
|
||||||
newAlbumArt.visible = true;
|
newAlbumArt.visible = true;
|
||||||
newAlbumArt.playAnimation(animNames.get('$albumId-active'), false, false, false);
|
newAlbumArt.playAnimation('intro', true);
|
||||||
|
|
||||||
difficultyStars.visible = false;
|
difficultyStars.visible = false;
|
||||||
new FlxTimer().start(0.75, function(_) {
|
new FlxTimer().start(0.75, function(_) {
|
||||||
// showTitle();
|
showTitle();
|
||||||
showStars();
|
showStars();
|
||||||
|
albumTitle.animation.play('switch');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public function skipIntro():Void
|
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
|
public function setDifficultyStars(?difficulty:Int):Void
|
||||||
|
|
|
@ -43,7 +43,7 @@ class FreeplayDJ extends FlxAtlasSprite
|
||||||
|
|
||||||
super(x, y, playableCharData.getAtlasPath());
|
super(x, y, playableCharData.getAtlasPath());
|
||||||
|
|
||||||
anim.callback = function(name, number) {
|
onAnimationFrame.add(function(name, number) {
|
||||||
if (name == playableCharData.getAnimationPrefix('cartoon'))
|
if (name == playableCharData.getAnimationPrefix('cartoon'))
|
||||||
{
|
{
|
||||||
if (number == playableCharData.getCartoonSoundClickFrame())
|
if (number == playableCharData.getCartoonSoundClickFrame())
|
||||||
|
@ -55,12 +55,12 @@ class FreeplayDJ extends FlxAtlasSprite
|
||||||
runTvLogic();
|
runTvLogic();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
|
||||||
FlxG.debugger.track(this);
|
FlxG.debugger.track(this);
|
||||||
FlxG.console.registerObject("dj", this);
|
FlxG.console.registerObject("dj", this);
|
||||||
|
|
||||||
anim.onComplete = onFinishAnim;
|
onAnimationComplete.add(onFinishAnim);
|
||||||
|
|
||||||
FlxG.console.registerFunction("freeplayCartoon", function() {
|
FlxG.console.registerFunction("freeplayCartoon", function() {
|
||||||
currentState = Cartoon;
|
currentState = Cartoon;
|
||||||
|
@ -96,7 +96,7 @@ class FreeplayDJ extends FlxAtlasSprite
|
||||||
var animPrefix = playableCharData.getAnimationPrefix('idle');
|
var animPrefix = playableCharData.getAnimationPrefix('idle');
|
||||||
if (getCurrentAnimation() != animPrefix)
|
if (getCurrentAnimation() != animPrefix)
|
||||||
{
|
{
|
||||||
playFlashAnimation(animPrefix, true);
|
playFlashAnimation(animPrefix, true, false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getCurrentAnimation() == animPrefix && this.isLoopFinished())
|
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) playFlashAnimation('Boyfriend DJ fist pump', false);
|
||||||
if (getCurrentAnimation() == animPrefix && anim.curFrame >= 4)
|
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:
|
case FistPump:
|
||||||
|
|
||||||
|
@ -135,9 +135,12 @@ class FreeplayDJ extends FlxAtlasSprite
|
||||||
timeIdling = 0;
|
timeIdling = 0;
|
||||||
case Cartoon:
|
case Cartoon:
|
||||||
var animPrefix = playableCharData.getAnimationPrefix('cartoon');
|
var animPrefix = playableCharData.getAnimationPrefix('cartoon');
|
||||||
if (animPrefix == null) {
|
if (animPrefix == null)
|
||||||
|
{
|
||||||
currentState = IdleEasterEgg;
|
currentState = IdleEasterEgg;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
if (getCurrentAnimation() != animPrefix) playFlashAnimation(animPrefix, true);
|
if (getCurrentAnimation() != animPrefix) playFlashAnimation(animPrefix, true);
|
||||||
timeIdling = 0;
|
timeIdling = 0;
|
||||||
}
|
}
|
||||||
|
@ -145,6 +148,7 @@ class FreeplayDJ extends FlxAtlasSprite
|
||||||
// I shit myself.
|
// I shit myself.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if debug
|
||||||
if (FlxG.keys.pressed.CONTROL)
|
if (FlxG.keys.pressed.CONTROL)
|
||||||
{
|
{
|
||||||
if (FlxG.keys.justPressed.LEFT)
|
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);
|
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);
|
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'))
|
if (name == playableCharData.getAnimationPrefix('intro'))
|
||||||
{
|
{
|
||||||
|
@ -220,7 +225,7 @@ class FreeplayDJ extends FlxAtlasSprite
|
||||||
// runTvLogic();
|
// runTvLogic();
|
||||||
}
|
}
|
||||||
trace('Replay idle: ${frame}');
|
trace('Replay idle: ${frame}');
|
||||||
anim.play(playableCharData.getAnimationPrefix('cartoon'), true, false, frame);
|
playAnimation(playableCharData.getAnimationPrefix('cartoon'), true, false, false, frame);
|
||||||
// trace('Finished confirm');
|
// trace('Finished confirm');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -266,7 +271,7 @@ class FreeplayDJ extends FlxAtlasSprite
|
||||||
function loadCartoon()
|
function loadCartoon()
|
||||||
{
|
{
|
||||||
cartoonSnd = FunkinSound.load(Paths.sound(getRandomFlashToon()), 1.0, false, true, true, function() {
|
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.
|
// Fade out music to 40% volume over 1 second.
|
||||||
|
@ -304,13 +309,13 @@ class FreeplayDJ extends FlxAtlasSprite
|
||||||
public function pumpFist():Void
|
public function pumpFist():Void
|
||||||
{
|
{
|
||||||
currentState = FistPump;
|
currentState = FistPump;
|
||||||
anim.play("Boyfriend DJ fist pump", true, false, 4);
|
playAnimation("Boyfriend DJ fist pump", true, false, false, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function pumpFistBad():Void
|
public function pumpFistBad():Void
|
||||||
{
|
{
|
||||||
currentState = FistPump;
|
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
|
override public function getCurrentAnimation():String
|
||||||
|
@ -319,9 +324,9 @@ class FreeplayDJ extends FlxAtlasSprite
|
||||||
return this.anim.curSymbol.name;
|
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();
|
applyAnimOffset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1795,7 +1795,7 @@ class FreeplayState extends MusicBeatSubState
|
||||||
confirmGlow.visible = true;
|
confirmGlow.visible = true;
|
||||||
confirmGlow2.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;
|
confirmGlow2.alpha = 0;
|
||||||
confirmGlow.alpha = 0;
|
confirmGlow.alpha = 0;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue