Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private function InitThings() : void {
- shapesArray = [];
- var screenWidth:int = 768;
- var screenHeight:int = 1024;
- var totalObjects:int = 8;
- var a:Number = (Math.PI * 2) / totalObjects;
- // This is the width & height of the object (it's a circle)
- var distanceBetweenObjects:Number = 62.0;
- // I added the size of the object here, this made it distribute closer to what I was trying to
- // achieve
- var distanceFromCenter:Number = ((distanceBetweenObjects * 0.5) / Math.cos(a * 0.5)) + 62;
- var accumulatedAngle:Number = 0.0;
- for (var i:int = 0; i < totalObjects; i++) {
- var shape:GameShape = new GameShape(Math.ceil(Math.random() * 6)); // , (0.14 * i));
- shapesArray.push(shape);
- addChild(shape);
- shape.x = (Math.cos(accumulatedAngle) * distanceFromCenter) + (screenWidth / 2);
- shape.y = (Math.sin(accumulatedAngle) * distanceFromCenter) + (screenHeight / 2);
- accumulatedAngle += a;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement