Search code examples
actionscript-3design-patternsrandomlinestroke

Actionscript 3, help required, pattern over drawn circle


http://madcomm.deviantart.com/art/System-generator-wip-611957633

This is what I am currently working on, and currently, I'm looking for a way (if any) to basically draw automatic, randomised asteroid belts.

The main idea I have, currently, would be to simply draw a circle with a pattern/stroke of asteroid sprites, but I have no idea how this could be achieved.

Ideally, the width and length of a circle of pattern would be randomised, then the sprites drawn.

Help would be greatly appreciated.

Current code to be found within the deviantart page.

Mostly looking for a way to paste objects over a circle I guess - such a function could be randomised, the circle behind "asteroid belt" wouldn't be particularly necessary. So either ability to draw a circle stroke of patterned sprites, or spawning sprites in a circular manner.


Solution

  • I would have a planet object. Add your Sprite objects to it as children at a chosen distance away from the center of the planet. After each sprite object is added, and before the next one is added, rotate the planet a random amount, then add the next one. You would do this with a for loop. You could also add them at a range of distances so they aren't all the same distance from the planet.