mirror of
https://github.com/FunkinCrew/Funkin.git
synced 2024-11-23 08:07:54 -05:00
Fix an issue where story menu characters bop too fast
This commit is contained in:
parent
7c99905312
commit
09029718aa
2 changed files with 20 additions and 11 deletions
|
@ -167,10 +167,7 @@ class Bopper extends StageProp implements IPlayStateScriptedClass
|
|||
|
||||
function update_shouldAlternate():Void
|
||||
{
|
||||
if (hasAnimation('danceLeft'))
|
||||
{
|
||||
this.shouldAlternate = true;
|
||||
}
|
||||
this.shouldAlternate = hasAnimation('danceLeft');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -228,10 +225,11 @@ class Bopper extends StageProp implements IPlayStateScriptedClass
|
|||
|
||||
/**
|
||||
* Ensure that a given animation exists before playing it.
|
||||
* Will gracefully check for name, then name with stripped suffixes, then 'idle', then fail to play.
|
||||
* @param name
|
||||
* Will gracefully check for name, then name with stripped suffixes, then fail to play.
|
||||
* @param name The animation name to attempt to correct.
|
||||
* @param fallback Instead of failing to play, try to play this animation instead.
|
||||
*/
|
||||
function correctAnimationName(name:String):String
|
||||
function correctAnimationName(name:String, ?fallback:String):String
|
||||
{
|
||||
// If the animation exists, we're good.
|
||||
if (hasAnimation(name)) return name;
|
||||
|
@ -247,14 +245,22 @@ class Bopper extends StageProp implements IPlayStateScriptedClass
|
|||
}
|
||||
else
|
||||
{
|
||||
if (name != 'idle')
|
||||
if (fallback != null)
|
||||
{
|
||||
FlxG.log.warn('Bopper tried to play animation "$name" that does not exist, fallback to idle...');
|
||||
return correctAnimationName('idle');
|
||||
if (fallback == name)
|
||||
{
|
||||
FlxG.log.error('Bopper tried to play animation "$name" that does not exist! This is bad!');
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
FlxG.log.warn('Bopper tried to play animation "$name" that does not exist, fallback to idle...');
|
||||
return correctAnimationName('idle');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
FlxG.log.error('Bopper tried to play animation "idle" that does not exist! This is bad!');
|
||||
FlxG.log.error('Bopper tried to play animation "$name" that does not exist! This is bad!');
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,6 +45,9 @@ class LevelProp extends Bopper
|
|||
this.visible = true;
|
||||
}
|
||||
|
||||
// Reset animation state.
|
||||
this.shouldAlternate = null;
|
||||
|
||||
var isAnimated:Bool = propData.animations.length > 0;
|
||||
if (isAnimated)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue