flash on 2012-3-16
/**
* Copyright MMMMMonchi ( http://wonderfl.net/user/MMMMMonchi )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/cxGy
*/
package
{
import flash.display.Sprite;
import flash.events.Event;
public class Main extends Sprite
{
private var bullets:Array;
private const MAX:int = 100;
public function Main()
{
bullets = new Array();
for (var i:int = 0; i < MAX; i++)
{
var bullet:Bullet = new Bullet(0x0, 5, Math.random() * 465, Math.random() * 465);
addChild(bullet);
bullets.push(bullet);
}
addEventListener(Event.ENTER_FRAME, onEnterFrame);
}
private function onEnterFrame(event:Event):void
{
for (var i:int = 0; i < bullets.length; i++)
{
bullets[i].move();
}
}
}
}
import flash.display.Sprite;
class Bullet extends Sprite
{
public function Bullet(color:int, radius:int, x:int, y:int)
{
graphics.beginFill(color);
graphics.drawCircle(0, 0, radius);
graphics.endFill();
this.x = x;
this.y = y;
}
public function move():void
{
this.x += 3;
this.y += 2;
}
}