GetAge

From ZDoom Wiki
Jump to navigation Jump to search

Actor

clearscope int GetAge () const

Usage

Retrieves the number of tics that have passed since the calling actor was spawned.

Return value

The age in tics as an integer.

Examples

This version of the Rocket will explode if it was still flying 2 seconds after its existence:

class TimedRocket : Rocket
{
	override void Tick()
	{
		Super.Tick();
 		// TICRATE is equal to 1 second (currently 35 tics)
		if (InStateSequence(curstate, spawnstate) && GetAge() >= TICRATE * 2)
		{
			ExplodeMissile();
		}
	}
}

See also