Advertisement
JademusSreg

CreateUnitsInCircle

Feb 24th, 2012
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.60 KB | None | 0 0
  1. unitgroup CreateUnitsInCircle (int quantity, string id, int player, point center, fixed radius, fixed polarAnchor, fixed faceAnchor)
  2. {
  3.     // Local variables
  4.     unitgroup g = UnitGroupEmpty();
  5.     int count = 0;
  6.     fixed angle = (360.0 / IntToFixed(quantity));
  7.     fixed adjust;
  8.     // While count is less than quantity, create units
  9.     while (count < quantity)
  10.     {
  11.         adjust = count * angle;
  12.         UnitGroupAddUnitGroup(g,UnitCreate(1,id,c_unitCreateIgnorePlacement,player,PointWithOffsetPolar(center,radius,polarAnchor-adjust),faceAnchor-adjust));
  13.         count+=1;
  14.     }
  15.     return g;
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement