First, pick a number from 0 to 359. Store it in a variable. I used i.
Next, use two variables to store floats. that is variable type real. Call them xr and yr for radius. Next you need an integer to store distance from center. I used d.
After these lines of code you can use xr and yr to add to an actor's x and y. This is good for special effects.
- Code: Select all
i = rand(360);
xr = cos(degtorad(i))*d;
yr = sin(degtorad(i))*d;
visual demonstration here.
http://www.dreade.org/applets/circlerandom/
Thanks to DST for the hosting.