Skip to content

Error with FlxBar rendering if fill direction is changed #3256

Open

Description

@DetectiveBaldi
  • Haxe version: 4.3.6
  • Flixel version: git
  • OpenFL version: git
  • Lime version: git
  • Affected targets: all
2024-09-25.18-22-47.mp4

the issue can be reproduced with this snippet:

package;

import flixel.FlxG;
import flixel.FlxState;
import flixel.ui.FlxBar;
import flixel.util.FlxColor;

class PlayState extends FlxState
{
	var health:Float = 50.0;

	var flx:FlxBar;

	override public function create()
	{
		super.create();

		flx = new FlxBar(0.0, 0.0, RIGHT_TO_LEFT, 640, 25, this, "health", 0.0, 100.0, true);

		flx.createFilledBar(0xFF66FF33, FlxColor.RED, true, FlxColor.BLACK, 5);

		add(flx);
	}

	override public function update(elapsed:Float)
	{
		super.update(elapsed);

		if (FlxG.keys.pressed.RIGHT)
			health--;

		if (FlxG.keys.pressed.LEFT)
			health++;

		if (FlxG.keys.justPressed.SPACE)
		{
			flx.fillDirection = flx.fillDirection == LEFT_TO_RIGHT ? RIGHT_TO_LEFT : LEFT_TO_RIGHT;

			trace("updated fill dir");
		}
	}
}

by pressing space, and then pressing right to reduce the health, which results in 2 visible green sects

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions