I have been working on a Flash game made in Flash Builder using the Flixel library. I have been trying to dynamically create a group of FlxSprites , and revolve them around a player controlled class that extends FlxSprite when the player uses a power up.
My thought on how to approach this, was to create a circle, use points on that circle to instantiate the sprites, and then somehow update those sprites to points along that circle during the game's update step. But I am not sure what would be the best way to hold information about a circle, or circular path's in ActionScript 3. I assumed that As3Math provided some of the means to do this, and I tried to add one sprite to a circle like this:
package { import As3Math.*; import As3Math.geo2d.amBoundCircle2d; import org.flixel.FlxGroup; import org.flixel.FlxState; public class ButterflyRing extends FlxGroup { [Embed(source="../Content/Images/spritesheet_butterfly_32x8.png")] var butterflySprite:Class; public function ButterflyRing(playState:FlxState,X:Number,Y:Number) { //add to super class super(); //create a circle motion path at coordinates x:150, y:150 with a radius of 100 var butterflyCircle:Math.amBoundCircle2d = new Math.amBoundCircle2d(150,50); var circDiameter:Number = butterflyCircle.radius/2; var pX:Number = butterflyCircle.center.x + circDiameter var pY:Number = butterflyCircle.center.y; var butterfly:SpriteButterfly = new SpriteButterfly(pX,pY); add(butterfly); } override public function update():void { super.update(); } } } I realize now this is not the correct way to use As3Math, that it is accessible by default and you call it like Math.pi. My question is, Does ActionsScript 3 have the means to do this in its code base, or do you have to define your own classes to hold information for a circle, or do you use Math.pi to build circles from scratch? What is a good approach for this? Or does Flixel provide something good for this?