mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2024-11-15 19:33:36 +00:00
Merge pull request #643 from FunkinCrew/feature/character-anim-fixes
Enable GF combo animations, several character animation issues
This commit is contained in:
commit
214f68c4c1
2
assets
2
assets
|
@ -1 +1 @@
|
||||||
Subproject commit d7ecd602df733f0625763a2d7b6056f52147b9e6
|
Subproject commit 8d5bc0dce1e0cb4f545037ce4040e7a5f2d85871
|
|
@ -151,7 +151,8 @@ class HitNoteScriptEvent extends NoteScriptEvent
|
||||||
public var hitDiff:Float = 0;
|
public var hitDiff:Float = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If the hit causes a notesplash
|
* Whether this note hit causes a note splash to display.
|
||||||
|
* Defaults to true only on "sick" notes.
|
||||||
*/
|
*/
|
||||||
public var doesNotesplash:Bool = false;
|
public var doesNotesplash:Bool = false;
|
||||||
|
|
||||||
|
|
|
@ -308,13 +308,26 @@ class BaseCharacter extends Bopper
|
||||||
// so we can query which ones are available.
|
// so we can query which ones are available.
|
||||||
this.comboNoteCounts = findCountAnimations('combo'); // example: combo50
|
this.comboNoteCounts = findCountAnimations('combo'); // example: combo50
|
||||||
this.dropNoteCounts = findCountAnimations('drop'); // example: drop50
|
this.dropNoteCounts = findCountAnimations('drop'); // example: drop50
|
||||||
// trace('${this.animation.getNameList()}');
|
if (comboNoteCounts.length > 0) trace('Combo note counts: ' + this.comboNoteCounts);
|
||||||
// trace('Combo note counts: ' + this.comboNoteCounts);
|
if (dropNoteCounts.length > 0) trace('Drop note counts: ' + this.dropNoteCounts);
|
||||||
// trace('Drop note counts: ' + this.dropNoteCounts);
|
|
||||||
|
|
||||||
super.onCreate(event);
|
super.onCreate(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override function onAnimationFinished(animationName:String):Void
|
||||||
|
{
|
||||||
|
super.onAnimationFinished(animationName);
|
||||||
|
|
||||||
|
trace('${characterId} has finished animation: ${animationName}');
|
||||||
|
if ((animationName.endsWith(Constants.ANIMATION_END_SUFFIX) && !animationName.startsWith('idle') && !animationName.startsWith('dance'))
|
||||||
|
|| animationName.startsWith('combo')
|
||||||
|
|| animationName.startsWith('drop'))
|
||||||
|
{
|
||||||
|
// Force the character to play the idle after the animation ends.
|
||||||
|
this.dance(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function resetCameraFocusPoint():Void
|
function resetCameraFocusPoint():Void
|
||||||
{
|
{
|
||||||
// Calculate the camera focus point
|
// Calculate the camera focus point
|
||||||
|
@ -368,9 +381,11 @@ class BaseCharacter extends Bopper
|
||||||
// and Darnell (this keeps the flame on his lighter flickering).
|
// and Darnell (this keeps the flame on his lighter flickering).
|
||||||
// Works for idle, singLEFT/RIGHT/UP/DOWN, alt singing animations, and anything else really.
|
// Works for idle, singLEFT/RIGHT/UP/DOWN, alt singing animations, and anything else really.
|
||||||
|
|
||||||
if (!getCurrentAnimation().endsWith('-hold') && hasAnimation(getCurrentAnimation() + '-hold') && isAnimationFinished())
|
if (!getCurrentAnimation().endsWith(Constants.ANIMATION_HOLD_SUFFIX)
|
||||||
|
&& hasAnimation(getCurrentAnimation() + Constants.ANIMATION_HOLD_SUFFIX)
|
||||||
|
&& isAnimationFinished())
|
||||||
{
|
{
|
||||||
playAnimation(getCurrentAnimation() + '-hold');
|
playAnimation(getCurrentAnimation() + Constants.ANIMATION_HOLD_SUFFIX);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle character note hold time.
|
// Handle character note hold time.
|
||||||
|
@ -395,7 +410,25 @@ class BaseCharacter extends Bopper
|
||||||
{
|
{
|
||||||
trace('holdTimer reached ${holdTimer}sec (> ${singTimeSec}), stopping sing animation');
|
trace('holdTimer reached ${holdTimer}sec (> ${singTimeSec}), stopping sing animation');
|
||||||
holdTimer = 0;
|
holdTimer = 0;
|
||||||
dance(true);
|
|
||||||
|
var currentAnimation:String = getCurrentAnimation();
|
||||||
|
// Strip "-hold" from the end.
|
||||||
|
if (currentAnimation.endsWith(Constants.ANIMATION_HOLD_SUFFIX)) currentAnimation = currentAnimation.substring(0,
|
||||||
|
currentAnimation.length - Constants.ANIMATION_HOLD_SUFFIX.length);
|
||||||
|
|
||||||
|
var endAnimation:String = currentAnimation + Constants.ANIMATION_END_SUFFIX;
|
||||||
|
if (hasAnimation(endAnimation))
|
||||||
|
{
|
||||||
|
// Play the '-end' animation, if one exists.
|
||||||
|
trace('${characterId}: playing ${endAnimation}');
|
||||||
|
playAnimation(endAnimation);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Play the idle animation.
|
||||||
|
trace('${characterId}: attempting dance');
|
||||||
|
dance(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -408,7 +441,8 @@ class BaseCharacter extends Bopper
|
||||||
|
|
||||||
public function isSinging():Bool
|
public function isSinging():Bool
|
||||||
{
|
{
|
||||||
return getCurrentAnimation().startsWith('sing');
|
var currentAnimation:String = getCurrentAnimation();
|
||||||
|
return currentAnimation.startsWith('sing') && !currentAnimation.endsWith(Constants.ANIMATION_END_SUFFIX);
|
||||||
}
|
}
|
||||||
|
|
||||||
override function dance(force:Bool = false):Void
|
override function dance(force:Bool = false):Void
|
||||||
|
@ -418,15 +452,15 @@ class BaseCharacter extends Bopper
|
||||||
|
|
||||||
if (!force)
|
if (!force)
|
||||||
{
|
{
|
||||||
|
// Prevent dancing while a singing animation is playing.
|
||||||
if (isSinging()) return;
|
if (isSinging()) return;
|
||||||
|
|
||||||
|
// Prevent dancing while a non-idle special animation is playing.
|
||||||
var currentAnimation:String = getCurrentAnimation();
|
var currentAnimation:String = getCurrentAnimation();
|
||||||
if ((currentAnimation == 'hey' || currentAnimation == 'cheer') && !isAnimationFinished()) return;
|
if (!currentAnimation.startsWith('dance') && !currentAnimation.startsWith('idle') && !isAnimationFinished()) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prevent dancing while another animation is playing.
|
trace('${characterId}: Actually dancing');
|
||||||
if (!force && isSinging()) return;
|
|
||||||
|
|
||||||
// Otherwise, fallback to the super dance() method, which handles playing the idle animation.
|
// Otherwise, fallback to the super dance() method, which handles playing the idle animation.
|
||||||
super.dance();
|
super.dance();
|
||||||
}
|
}
|
||||||
|
@ -499,6 +533,16 @@ class BaseCharacter extends Bopper
|
||||||
this.playSingAnimation(event.note.noteData.getDirection(), false);
|
this.playSingAnimation(event.note.noteData.getDirection(), false);
|
||||||
holdTimer = 0;
|
holdTimer = 0;
|
||||||
}
|
}
|
||||||
|
else if (characterType == GF && event.note.noteData.getMustHitNote())
|
||||||
|
{
|
||||||
|
switch (event.judgement)
|
||||||
|
{
|
||||||
|
case 'sick' | 'good':
|
||||||
|
playComboAnimation(event.comboCount);
|
||||||
|
default:
|
||||||
|
playComboDropAnimation(event.comboCount);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -521,25 +565,40 @@ class BaseCharacter extends Bopper
|
||||||
}
|
}
|
||||||
else if (event.note.noteData.getMustHitNote() && characterType == GF)
|
else if (event.note.noteData.getMustHitNote() && characterType == GF)
|
||||||
{
|
{
|
||||||
var dropAnim = '';
|
playComboDropAnimation(Highscore.tallies.combo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Choose the combo drop anim to play.
|
function playComboAnimation(comboCount:Int):Void
|
||||||
// If there are several (for example, drop10 and drop50) the highest one will be used.
|
{
|
||||||
// If the combo count is too low, no animation will be played.
|
var comboAnim = 'combo${comboCount}';
|
||||||
for (count in dropNoteCounts)
|
if (hasAnimation(comboAnim))
|
||||||
{
|
{
|
||||||
if (event.comboCount >= count)
|
trace('Playing GF combo animation: ${comboAnim}');
|
||||||
{
|
this.playAnimation(comboAnim, true, true);
|
||||||
dropAnim = 'drop${count}';
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (dropAnim != '')
|
function playComboDropAnimation(comboCount:Int):Void
|
||||||
|
{
|
||||||
|
var dropAnim:Null<String> = null;
|
||||||
|
|
||||||
|
// Choose the combo drop anim to play.
|
||||||
|
// If there are several (for example, drop10 and drop50) the highest one will be used.
|
||||||
|
// If the combo count is too low, no animation will be played.
|
||||||
|
for (count in dropNoteCounts)
|
||||||
|
{
|
||||||
|
if (comboCount >= count)
|
||||||
{
|
{
|
||||||
trace('Playing GF combo drop animation: ${dropAnim}');
|
dropAnim = 'drop${count}';
|
||||||
this.playAnimation(dropAnim, true, true);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (dropAnim != null)
|
||||||
|
{
|
||||||
|
trace('Playing GF combo drop animation: ${dropAnim}');
|
||||||
|
this.playAnimation(dropAnim, true, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -283,6 +283,21 @@ class Constants
|
||||||
*/
|
*/
|
||||||
public static final DEFAULT_TIME_SIGNATURE_DEN:Int = 4;
|
public static final DEFAULT_TIME_SIGNATURE_DEN:Int = 4;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ANIMATIONS
|
||||||
|
*/
|
||||||
|
// ==============================
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A suffix used for animations played when an animation would loop.
|
||||||
|
*/
|
||||||
|
public static final ANIMATION_HOLD_SUFFIX:String = '-hold';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A suffix used for animations played when an animation would end before transitioning to another.
|
||||||
|
*/
|
||||||
|
public static final ANIMATION_END_SUFFIX:String = '-end';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TIMING
|
* TIMING
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in a new issue