A_FadeOut

From ZDoom Wiki
Jump to navigation Jump to search

A_FadeOut [(float reduce_amount [, int flags])]

Usage

Increases the actor's translucency (decreases its alpha) by the specified amount. When the actor is fully transparent it will be removed, unless remove is explicitly set to false (it is true by default). This can be used to slowly fade out some things in a loop. If reduce_amount is not provided, it defaults to 0.1.

Parameters

  • reduce_amount: The amount by which to reduce the actor's alpha.
  • flags: The following flags can be combined using the pipe character | between the constant names:
    • FTF_REMOVE — the actor is removed from the game once its alpha reaches 0. This flag is implied by default, and is equivalent to using "TRUE" in earlier versions of ZDoom. To prevent this from occurring, use 0.
    • FTF_CLAMP — the alpha cannot go below 0.

Examples

This is a cacodemon fireball which slowly fades out of existence when it is fired.

ACTOR Fadeball : CacodemonBall
{
  RenderStyle "Translucent"
  Alpha 1.0
  States
  {
  Spawn:
    BAL2 AB 4 Bright A_FadeOut(0.2)
    Loop
  }
}

This code replaces plasma balls with a custom PlasmaBall with trails.

Actor CoolPlasmaBall : PlasmaBall replaces PlasmaBall
{
   Radius 9
   Height 6
   Scale 0.75
   RenderStyle Add
   Alpha 0.8
   
   States
   {
   Spawn:
     PLSS AAAAAABBBBBB 1 Bright A_SpawnItemEx("CPBTrail", 0, 0, 0, 0, 0, 0, 0, 0)
     Loop
   }
}

Actor CPBTrail
{
   Radius 9
   Height 6
   Scale 0.75
   RenderStyle Add
   Alpha 0.8
   
   +NOGRAVITY
   +NOBLOCKMAP
   +NOCLIP
   
   States
   {
   Spawn:
     PLSS AAAAAABBBBBB 1 Bright A_FadeOut
     Loop
   }
}

See Also