IsBlinking

From ZDoom Wiki
Jump to navigation Jump to search

Powerup

virtual clearscope bool isBlinking() const

Usage

A virtual function of the Powerup class that checks if the powerup is currently "blinking", i.e. close to running out, and returns true whenever it's "blinking out". By default, is set up in such a way that it returns true for 8 tics, then false for 8 subsequent tics.

Used by the powerups themselves to determine if Powerup.Colormap should be applied to player's screen. Could also be used by HUDs, for example, to change the opacity of the powerup's icon in the HUD.

Return values

Returns true if the powerup is currently "blinking out".

ZScript definition

Note: The ZScript definition below is for reference and may be different in the current version of GZDoom.The most up-to-date version of this code can be found on GZDoom GitHub.

The base Powerup class defines it as follows:

	virtual clearscope bool isBlinking() const
	{
		return (EffectTics <= BLINKTHRESHOLD && (EffectTics & 8) && !bNoScreenBlink);
	}

This returns true for 8 tics, while the powerup's effectTics (the current number of remaining tics) is equal to less than BLINKTHRESHOLD (a constant equal to 4*32, i.e. 128) and the INVENTORY.NOSCREENBLINK flag is false. Every 8 tics the value is flipped.

Examples

Nuvolachalk.png Note: This article lists no examples. If you make use of this feature in your own project(s) or know of any basic examples that could be shared, please add them. This will make it easier to understand for future authors seeking assistance. Your contributions are greatly appreciated.


See also