I have something odd happening when I update a FlxSprite's alpha repeatedly to make it fade out. Instead of taking 150 seconds to fade out completely (I actually want 15 seconds), it fades out over maybe 2 seconds. I tried tracing the actual alpha value, and the sprite is invisible when the alpha value is around 0.95 (95% opacity, ie slightly transparent).
Does anyone know how I can get the alpha to work properly in Flixel?
override public function update():void {
lifespan += FlxG.elapsed;
if (lifespan > 3) {
alpha = (1 - ((lifespan - 3) / 150)); // <--- this line
}
if (alpha < 0.01) {
State.s.remove(this, true);
}
super.update();
}