I am trying to create something like Galaxian.
I have enemy spaceships that I store in
When bullet overlaps an enemy I call
public function onOverlap()
this.setColorTransform(1, 0.4 + (HP / 10), 0.4 + (HP / 10));
if (HP <= 0)
this is what happens in the playstate loop:
override public function update(elapsed:Float)
FlxG.overlap(enemies, playerBullets, onOverlap);
function onOverlap(enemy:Enemy, bullet:Bullet)
if (enemy.alive && enemy.exists && bullet.alive && bullet.exists)
if (enemy.alive == false)
explosion = new Explosion(enemy.x, enemy.y);
Seems I do everything right but after the first overlap all my enemy spaceships starts flickering and disappear...
And it looks like a complete chaos.
I have no idea how I can fix the issue... could anybody help to resolve?