mirror of
https://github.com/FunkinCrew/Funkin.git
synced 2024-11-30 03:25:47 -05:00
Merge pull request #381 from FunkinCrew/bugfix/story-menu-fast-bop
Fix an issue where story menu characters bop too fast
This commit is contained in:
commit
dab80f4f60
2 changed files with 20 additions and 11 deletions
|
@ -167,10 +167,7 @@ class Bopper extends StageProp implements IPlayStateScriptedClass
|
||||||
|
|
||||||
function update_shouldAlternate():Void
|
function update_shouldAlternate():Void
|
||||||
{
|
{
|
||||||
if (hasAnimation('danceLeft'))
|
this.shouldAlternate = hasAnimation('danceLeft');
|
||||||
{
|
|
||||||
this.shouldAlternate = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -228,10 +225,11 @@ class Bopper extends StageProp implements IPlayStateScriptedClass
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ensure that a given animation exists before playing it.
|
* 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.
|
* Will gracefully check for name, then name with stripped suffixes, then fail to play.
|
||||||
* @param name
|
* @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 the animation exists, we're good.
|
||||||
if (hasAnimation(name)) return name;
|
if (hasAnimation(name)) return name;
|
||||||
|
@ -247,14 +245,22 @@ class Bopper extends StageProp implements IPlayStateScriptedClass
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (name != 'idle')
|
if (fallback != null)
|
||||||
|
{
|
||||||
|
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...');
|
FlxG.log.warn('Bopper tried to play animation "$name" that does not exist, fallback to idle...');
|
||||||
return correctAnimationName('idle');
|
return correctAnimationName('idle');
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
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;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,6 +45,9 @@ class LevelProp extends Bopper
|
||||||
this.visible = true;
|
this.visible = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Reset animation state.
|
||||||
|
this.shouldAlternate = null;
|
||||||
|
|
||||||
var isAnimated:Bool = propData.animations.length > 0;
|
var isAnimated:Bool = propData.animations.length > 0;
|
||||||
if (isAnimated)
|
if (isAnimated)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue