fix: fix A-Bot bars to display no volume, rather than 1 single bar, on no input

This commit is contained in:
Cameron Taylor
2024-12-18 12:08:14 -05:00
committed by Eric
parent 69b7bcb58b
commit a5a5382a60
2 changed files with 10 additions and 2 deletions
+7 -1
View File
@@ -105,7 +105,13 @@ class ABotVis extends FlxTypedSpriteGroup<FlxSprite>
for (i in 0...min(group.members.length, levels.length))
{
var animFrame:Int = Math.round(levels[i].value * 5);
var animFrame:Int = Math.round(levels[i].value * 6);
// don't display if we're at 0 volume from the level
group.members[i].visible = animFrame > 0;
// decrement our animFrame, so we can get a value from 0-5 for animation frames
animFrame -= 1;
#if desktop
// Web version scales with the Flixel volume level.
@@ -210,6 +210,7 @@ class FlxAtlasSprite extends FlxAnimate
/**
* Returns true if the animation has finished playing.
* Never true if animation is configured to loop.
* @return Whether the animation has finished playing.
*/
public function isAnimationFinished():Bool
{
@@ -221,6 +222,7 @@ class FlxAtlasSprite extends FlxAnimate
/**
* Returns true if the animation has reached the last frame.
* Can be true even if animation is configured to loop.
* @return Whether the animation has reached the last frame.
*/
public function isLoopComplete():Bool
{
@@ -255,7 +257,7 @@ class FlxAtlasSprite extends FlxAnimate
this.anim.goToFrameLabel(label);
}
function getFrameLabelNames(?layer:haxe.extern.EitherType<Int, String> = null)
function getFrameLabelNames(?layer:haxe.extern.EitherType<Int, String>):Array<String>
{
var labels = this.anim.getFrameLabels(layer);
var array = [];