A_FadeTo

From ZDoom Wiki
Jump to navigation Jump to search

A_FadeTo (float target [, float amount [, bool remove]])
A_FadeTo (float target [, float amount [, int flags]])

Usage

Alters transparency towards target by amount. This can be used to slowly fade in or out some things in a loop.

Parameters

  • target: The alpha value to fade towards.
  • amount: The amount by which to change the actor's alpha. Default is 0.1.
  • remove: If true, the actor is removed from the game once its alpha reaches target. Otherwise, if false, it is not. Default is true.
  • 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 target.
    • FTF_CLAMP — the alpha cannot go below 0 or above 1.0.

Example

Stealth Spider demon:

Actor StealthSpiderDemon4ZDWiki: SpiderMasterMind replaces SpiderMasterMind
{
 States
 {
 See:
   SPID A 0 A_FadeTo( 0.01, 0.15 )
   SPID A 3 A_Metal
   SPID A 0 A_FadeTo( 0.01, 0.15 )
   SPID ABB 3 A_Chase
   SPID B 0 A_FadeTo( 0.01, 0.15 )
   SPID C 3 A_Metal
   SPID C 0 A_FadeTo( 0.01, 0.15 )
   SPID CDD 3 A_Chase
   SPID D 0 A_FadeTo( 0.01, 0.15 )
   SPID E 3 A_Metal
   SPID E 0 A_FadeTo( 0.01, 0.15 )
   SPID EFF 3 A_Chase
   SPID F 0 A_FadeTo( 0.01, 0.15 )
   Loop
 Missile:
   SPID A 1 A_FaceTarget
   SPID AAAAAAAAAAAAAAAAAA 1 Bright A_FadeTo( 1.0 )
   SPID A 1 A_FaceTarget
   SPID G 4 Bright A_SPosAttackUseAtkSound
   SPID H 4 Bright A_SPosAttackUseAtkSound
   SPID H 1 Bright A_SpidRefire
   Goto Missile + 20
 Pain:
   SPID I 0 A_FadeTo( 1.0, 0.2 )
   SPID III 1 A_FadeTo( 1.0, 0.2 )
   SPID I 3 A_Pain
   SPID I 0 A_FadeTo( 1.0, 0.2 )
   Goto See
 Death:
   SPID J 0 A_FadeTo( 1.0 )
   SPID J 1 A_Scream
   SPID JJJJJJJJJJJJJJJJJJJ 1 A_FadeTo( 1.0 )
   SPID K 10 A_NoBlocking
   SPID LMNOPQR 10
   SPID S 30
   SPID S -1 A_BossDeath
   Stop
 }
}

See Also