Cos

From ZDoom Wiki
Revision as of 19:53, 28 December 2007 by HotWax (talk | contribs) (→‎Example: Copied sin example here)
Jump to navigation Jump to search

int Cos (int angle)

Usage

Returns the value for the cosine of angle.

Parameters

  • angle
The fixed point angle value to compute the cosine for.

Return value

Returns an fixed point value of the cosine.

Example

This script spawns two medikits on the left & right side of the activator when activated.

script 1 (void)
{
    int x = GetActorX (0);
    int y = GetActorY (0);
    int z = GetActorZ (0) + 32.0;
    int angle = GetActorAngle (0);

    Spawn ("Medikit", x + cos (angle + 0.25) * 32, y + sin (angle + 0.25) * 32, z);
    Spawn ("Medikit", x + cos (angle + 0.75) * 32, y + sin (angle + 0.75) * 32, z);
}