spawnradius

From ZDoom Wiki

Jump to: navigation, search

This function acts as an extension to Spawn, used to spawn things in circular patterns. It uses a MapSpot (or any other thing) as a base, and will spawn the object at the appropriate angle and radius relative to the MapSpot as the center. The radius is supplied in grid units, and angles are supplied as vector angles, which is necessary for cos and sin to generate the correct position.

function void spawnradius (str type, int spotid, int radius, int angle, int newtid)
{
    int x, y;
    x = GetActorX(spotid) + radius * cos(angle);
    y = GetActorY(spotid) + radius * sin(angle);
    Spawn(type, x, y, GetActorZ(spotid), newtid, angle >> 8);
}
Personal tools