A_SetBlend

From ZDoom Wiki
Jump to navigation Jump to search


Actor

native void A_SetBlend(color color1, double alpha, int tics, color color2 = 0, double alpha2 = 0.)

Usage

Sets a palette blend effect to the calling player's screen. Only has an effect if called on a PlayerPawn-based class.

Parameters

  • color color1
The color that the player's screen will be immediately tinted to. Can be specified in any of the accepted color formats (with the alpha part being ignored, since it's specified separately).
  • double alpha
The opacity of color1 in a [0.0, 1.0] range.
  • int tics
The time in tics to fade from color1 to color2.
  • color color2
The color that the player's screen will be faded to from color1 over tics. By default is 0, which means the initial color will fade away, leaving no tint.
  • double alpha2
The opacity of color2 in a [0.0, 1.0] range.

Examples

This is an example of a custom DoomPlayer that has a separate Pain state sequence for the "Zorch" damage type, where their screen briefly flashes:

class MyCustomPlayerClass : DoomPlayer
{
	States
	{
	Pain.Zorch:
		PLAY O 4 A_SetBlend("992020", 0.5, 5);
		PLAY O 4 A_Pain;
		Goto Spawn;
	}
}

This is a version of the Stimpack that causes the player's screen to briefly flash when it's picked up:

class StimpackFlash : Stimpack
{
	override bool TryPickup (in out Actor toucher)
	{
		let ret = super.TryPickup(toucher);
		if (ret && toucher)
		{
			toucher.A_SetBlend(0xCC0000, 0.25, 20);
		}
		return ret;
	}
}

(See also: TryPickup)