i'm using SDL engine to make a game... and i need to know how to make my characters spawn using a random spawn function with in a certain radius.... if anyone could give me some ideas... it would be appreciated
// generate an object at a distance further than 'minradius' but no further than 'maxradius'
// from point X,Y
int distance = rand() % (maxradius - minradius) + minradius;
int angle = rand() % 360;
int dx = (int)( cos(angle * PI / 180) * distance );
int dy = (int)( sin(angle * PI / 180) * distance );
GenerateObject( dx + X, dy + Y );