flash on 2010-4-13

by kihon
♥0 | Line 36 | Modified 2010-04-13 22:56:04 | MIT License
play

ActionScript3 source code

/**
 * Copyright kihon ( http://wonderfl.net/user/kihon )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/iMMp
 */

package
{
	import flash.display.Sprite;
	import flash.events.Event;
 
	public class Main extends Sprite
	{
		private var bullet:Bullet;
 
		public function Main()
		{
			bullet = new Bullet(0xED1A3D, 10, 232, 232);
			addChild(bullet);
 
			addEventListener(Event.ENTER_FRAME, onEnterFrame);
		}
 
		private function onEnterFrame(event:Event):void
		{
			bullet.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;
	}
}

Forked