Closed DinoMah closed 2 weeks ago
I don't think this is a proper recreation of the issue you're seeing, there's not much to go on and it doesn't even recycle a bullet. I tried it anyways and made this:
package states;
import flixel.group.FlxGroup;
class RecyclingTestState3185 extends flixel.FlxState
{
var bullets:FlxTypedGroup<Bullet>;
override function create()
{
super.create();
bullets = new FlxTypedGroup();
var bullet = new Bullet();
bullets.add(bullet);
bullet.kill();
}
override function update(elapsed)
{
super.update(elapsed);
var bullet = bullets.recycle(Bullet);
if (bullets.length > 1)
throw "Bullet wasn't recycled";
if (bullet.graphic == null || bullet.graphic.isDestroyed)
throw "Bullet was destroyed";
bullet.kill();
}
}
class Bullet extends flixel.FlxSprite
{
public function new()
{
super();
makeGraphic(30, 30);
}
override function kill()
{
super.kill();
}
override function revive()
{
super.revive();
}
}
I'm not seeing any evidence that the bullet is being destroyed. Please when making tests like this make sure to actually run them in a new project and make sure it produces the behavior you are trying to communicate
I see no reason in code why kill() revive() or recycle() would destroy a graphic, so I assume it's a problem with your project, if you're able to make a test that does reproduce this, please reopen this issue
Observed behavior: When reviving sometimes it doesn't have a graphic
Expected behavior: Graphics doesn't get destroyed or something