1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-12-23 21:56:46 +00:00

Pico Fist Pump animation (with loss animation)

This commit is contained in:
EliteMasterEric 2024-08-28 06:08:30 -04:00
parent 2e7eabc494
commit 16a6dba9df
4 changed files with 183 additions and 17 deletions

View file

@ -38,6 +38,11 @@ class PlayerData
@:optional @:optional
public var freeplayDJ:Null<PlayerFreeplayDJData> = null; public var freeplayDJ:Null<PlayerFreeplayDJData> = null;
/**
* Data for displaying this character in the results screen.
*/
@:optional
public var results:Null<PlayerResultsData> = null; public var results:Null<PlayerResultsData> = null;
/** /**
@ -97,6 +102,9 @@ class PlayerFreeplayDJData
@:optional @:optional
var cartoon:Null<PlayerFreeplayDJCartoonData>; var cartoon:Null<PlayerFreeplayDJCartoonData>;
@:optional
var fistPump:Null<PlayerFreeplayDJFistPumpData>;
public function new() public function new()
{ {
animationMap = new Map(); animationMap = new Map();
@ -183,6 +191,46 @@ class PlayerFreeplayDJData
{ {
return cartoon?.channelChangeFrame ?? 60; return cartoon?.channelChangeFrame ?? 60;
} }
public function getFistPumpIntroStartFrame():Int
{
return fistPump?.introStartFrame ?? 0;
}
public function getFistPumpIntroEndFrame():Int
{
return fistPump?.introEndFrame ?? 0;
}
public function getFistPumpLoopStartFrame():Int
{
return fistPump?.loopStartFrame ?? 0;
}
public function getFistPumpLoopEndFrame():Int
{
return fistPump?.loopEndFrame ?? 0;
}
public function getFistPumpIntroBadStartFrame():Int
{
return fistPump?.introBadStartFrame ?? 0;
}
public function getFistPumpIntroBadEndFrame():Int
{
return fistPump?.introBadEndFrame ?? 0;
}
public function getFistPumpLoopBadStartFrame():Int
{
return fistPump?.loopBadStartFrame ?? 0;
}
public function getFistPumpLoopBadEndFrame():Int
{
return fistPump?.loopBadEndFrame ?? 0;
}
} }
typedef PlayerResultsData = typedef PlayerResultsData =
@ -242,3 +290,30 @@ typedef PlayerFreeplayDJCartoonData =
var loopFrame:Int; var loopFrame:Int;
var channelChangeFrame:Int; var channelChangeFrame:Int;
} }
typedef PlayerFreeplayDJFistPumpData =
{
@:default(0)
var introStartFrame:Int;
@:default(4)
var introEndFrame:Int;
@:default(4)
var loopStartFrame:Int;
@:default(-1)
var loopEndFrame:Int;
@:default(0)
var introBadStartFrame:Int;
@:default(4)
var introBadEndFrame:Int;
@:default(4)
var loopBadStartFrame:Int;
@:default(-1)
var loopBadEndFrame:Int;
};

View file

@ -315,7 +315,7 @@ class Bopper extends StageProp implements IPlayStateScriptedClass
public function isAnimationFinished():Bool public function isAnimationFinished():Bool
{ {
return this.animation.finished; return this.animation?.finished ?? false;
} }
public function setAnimationOffsets(name:String, xOffset:Float, yOffset:Float):Void public function setAnimationOffsets(name:String, xOffset:Float, yOffset:Float):Void

View file

@ -116,13 +116,54 @@ class FreeplayDJ extends FlxAtlasSprite
if (getCurrentAnimation() != animPrefix) playFlashAnimation(animPrefix, false); if (getCurrentAnimation() != animPrefix) playFlashAnimation(animPrefix, false);
timeIdling = 0; timeIdling = 0;
case FistPumpIntro: case FistPumpIntro:
var animPrefix = playableCharData.getAnimationPrefix('fistPump'); var animPrefixA = playableCharData.getAnimationPrefix('fistPump');
if (getCurrentAnimation() != animPrefix) playFlashAnimation('Boyfriend DJ fist pump', false); var animPrefixB = playableCharData.getAnimationPrefix('loss');
if (getCurrentAnimation() == animPrefix && anim.curFrame >= 4)
if (getCurrentAnimation() == animPrefixA)
{ {
playAnimation("Boyfriend DJ fist pump", true, false, false, 0); var endFrame = playableCharData.getFistPumpIntroEndFrame();
if (endFrame > -1 && anim.curFrame >= endFrame)
{
playFlashAnimation(animPrefixA, true, false, false, playableCharData.getFistPumpIntroStartFrame());
}
} }
else if (getCurrentAnimation() == animPrefixB)
{
var endFrame = playableCharData.getFistPumpIntroBadEndFrame();
if (endFrame > -1 && anim.curFrame >= endFrame)
{
playFlashAnimation(animPrefixB, true, false, false, playableCharData.getFistPumpIntroBadStartFrame());
}
}
else
{
FlxG.log.warn("Unrecognized animation in FistPumpIntro: " + getCurrentAnimation());
}
case FistPump: case FistPump:
var animPrefixA = playableCharData.getAnimationPrefix('fistPump');
var animPrefixB = playableCharData.getAnimationPrefix('loss');
if (getCurrentAnimation() == animPrefixA)
{
var endFrame = playableCharData.getFistPumpLoopEndFrame();
if (endFrame > -1 && anim.curFrame >= endFrame)
{
playFlashAnimation(animPrefixA, true, false, false, playableCharData.getFistPumpLoopStartFrame());
}
}
else if (getCurrentAnimation() == animPrefixB)
{
var endFrame = playableCharData.getFistPumpLoopBadEndFrame();
if (endFrame > -1 && anim.curFrame >= endFrame)
{
playFlashAnimation(animPrefixB, true, false, false, playableCharData.getFistPumpLoopBadStartFrame());
}
}
else
{
FlxG.log.warn("Unrecognized animation in FistPump: " + getCurrentAnimation());
}
case IdleEasterEgg: case IdleEasterEgg:
var animPrefix = playableCharData.getAnimationPrefix('idleEasterEgg'); var animPrefix = playableCharData.getAnimationPrefix('idleEasterEgg');
@ -271,7 +312,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() {
playAnimation("Boyfriend DJ watchin tv OG", true, false, false, 60); playFlashAnimation(playableCharData.getAnimationPrefix('cartoon'), true, false, false, 60);
}); });
// Fade out music to 40% volume over 1 second. // Fade out music to 40% volume over 1 second.
@ -301,21 +342,32 @@ class FreeplayDJ extends FlxAtlasSprite
currentState = Confirm; currentState = Confirm;
} }
public function fistPump():Void public function fistPumpIntro():Void
{ {
currentState = FistPumpIntro; currentState = FistPumpIntro;
var animPrefix = playableCharData.getAnimationPrefix('fistPump');
playFlashAnimation(animPrefix, true, false, false, playableCharData.getFistPumpIntroStartFrame());
} }
public function pumpFist():Void public function fistPump():Void
{ {
currentState = FistPump; currentState = FistPump;
playAnimation("Boyfriend DJ fist pump", true, false, false, 4); var animPrefix = playableCharData.getAnimationPrefix('fistPump');
playFlashAnimation(animPrefix, true, false, false, playableCharData.getFistPumpLoopStartFrame());
} }
public function pumpFistBad():Void public function fistPumpLossIntro():Void
{
currentState = FistPumpIntro;
var animPrefix = playableCharData.getAnimationPrefix('loss');
playFlashAnimation(animPrefix, true, false, false, playableCharData.getFistPumpIntroBadStartFrame());
}
public function fistPumpLoss():Void
{ {
currentState = FistPump; currentState = FistPump;
playAnimation("Boyfriend DJ loss reaction 1", true, false, false, 4); var animPrefix = playableCharData.getAnimationPrefix('loss');
playFlashAnimation(animPrefix, true, false, false, playableCharData.getFistPumpLoopBadStartFrame());
} }
override public function getCurrentAnimation():String override public function getCurrentAnimation():String
@ -366,12 +418,43 @@ class FreeplayDJ extends FlxAtlasSprite
} }
} }
enum DJBoyfriendState enum FreeplayDJState
{ {
/**
* Character enters the frame and transitions to Idle.
*/
Intro; Intro;
/**
* Character loops in idle.
*/
Idle; Idle;
/**
* Plays an easter egg animation after a period in Idle, then reverts to Idle.
*/
IdleEasterEgg;
/**
* Plays an elaborate easter egg animation. Does not revert until another animation is triggered.
*/
Cartoon;
/**
* Player has selected a song.
*/
Confirm; Confirm;
/**
* Character preps to play the fist pump animation; plays after the Results screen.
* The actual frame label that gets played may vary based on the player's success.
*/
FistPumpIntro; FistPumpIntro;
/**
* Character plays the fist pump animation.
* The actual frame label that gets played may vary based on the player's success.
*/
FistPump; FistPump;
IdleEasterEgg; IdleEasterEgg;
Cartoon; Cartoon;

View file

@ -644,8 +644,8 @@ class FreeplayState extends MusicBeatSubState
speed: 0.3 speed: 0.3
}); });
var diffSelLeft:DifficultySelector = new DifficultySelector(20, grpDifficulties.y - 10, false, controls); var diffSelLeft:DifficultySelector = new DifficultySelector(this, 20, grpDifficulties.y - 10, false, controls);
var diffSelRight:DifficultySelector = new DifficultySelector(325, grpDifficulties.y - 10, true, controls); var diffSelRight:DifficultySelector = new DifficultySelector(this, 325, grpDifficulties.y - 10, true, controls);
diffSelLeft.visible = false; diffSelLeft.visible = false;
diffSelRight.visible = false; diffSelRight.visible = false;
add(diffSelLeft); add(diffSelLeft);
@ -913,7 +913,15 @@ class FreeplayState extends MusicBeatSubState
changeSelection(); changeSelection();
changeDiff(); changeDiff();
if (dj != null) dj.fistPump(); if (fromResultsParams?.newRank == SHIT)
{
if (dj != null) dj.fistPumpLossIntro();
}
else
{
if (dj != null) dj.fistPumpIntro();
}
// rankCamera.fade(FlxColor.BLACK, 0.5, true); // rankCamera.fade(FlxColor.BLACK, 0.5, true);
rankCamera.fade(0xFF000000, 0.5, true, null, true); rankCamera.fade(0xFF000000, 0.5, true, null, true);
if (FlxG.sound.music != null) FlxG.sound.music.volume = 0; if (FlxG.sound.music != null) FlxG.sound.music.volume = 0;
@ -1095,11 +1103,11 @@ class FreeplayState extends MusicBeatSubState
if (fromResultsParams?.newRank == SHIT) if (fromResultsParams?.newRank == SHIT)
{ {
if (dj != null) dj.pumpFistBad(); if (dj != null) dj.fistPumpLoss();
} }
else else
{ {
if (dj != null) dj.pumpFist(); if (dj != null) dj.fistPump();
} }
rankCamera.zoom = 0.8; rankCamera.zoom = 0.8;