HaxeFlixel / HaxeFlixel/flixel

Toggling FlxSpriteGroup visibility resets visibility of all sprites in it

Open
#2,403 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Haxe
Stars
2.2k
Forks
522
Avg merge
34m
Merged PRs (30d)
1

Description

  • Haxe version: 4.2.3
  • Flixel version: 4.9.0
  • OpenFL version: 9.1.0
  • Lime version: 7.9.0
  • Affected targets: Tested on Linux and HTML5, probably affects others

Code snippet reproducing the issue:

package;

import flixel.FlxSprite;
import flixel.group.FlxSpriteGroup;
import flixel.FlxState;

class PlayState extends FlxState
{
	override public function create()
	{
		super.create();
		
		// Create an FlxSpriteGroup
		var group = new FlxSpriteGroup(50, 50);
		add(group);
		
		// Add sprites to the group
		var red = new FlxSprite(0, 0).makeGraphic(100, 100, 0xFFFF0000);
		group.add(red);
		var green = new FlxSprite(50, 50).makeGraphic(100, 100, 0xFF00FF00);
		group.add(green);
		
		// Make one invisible
		green.visible = false;
		
		// Toggle the visiblilty of the group
		group.visible = false;
		group.visible = true;
	}
}

Observed behavior:
Both sprites are visible at the end of create().

Expected behavior:
The green sprite stays invisible, even when the visibility of the FlxSpriteGroup is toggled off and on.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the FlxSpriteGroup visibility behavior described in the issue and run the supplied PlayState reproduction on the listed targets. Done means the green sprite remains invisible after the group is toggled off and back on, while the red sprite remains visible.

Written by the indexing model from the issue text.

Assessment

Domain
game-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.