QuickBox2Dを使ってBox2DAS3を簡単に

by Evolutor
♥1 | Line 19 | Modified 2010-01-25 10:11:42 | MIT License
play

ActionScript3 source code

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

package{
	import flash.display.MovieClip;
	import com.actionsnippet.qbox.*;
	
	public class Main extends MovieClip{
		public function Main():void{
			var sim:QuickBox2D = new QuickBox2D(this);
			//壁生成
			sim.addBox( { x:7.8, y:16, width:16, density:0, lineAlpha:1, fillAlpha:0 }); //床
			sim.addBox( { x:-0.5, y:0, height:200, density:0, lineAlpha:1, fillAlpha:0 }); //右壁
			sim.addBox( { x:16, y:0, height:200, density:0, lineAlpha:1, fillAlpha:0 }); //左壁
			
			for(var i =0; i<9; i++){
				sim.addBox( { x:7, y:5-i, width:2, height:1, isBullet:true } );
				sim.start();
			}
			// 斜めの床生成
			sim.addBox( { x:4, y:7, width:7, height:.3, angle:0.3, density:0, fillColor:0xff0000 } );
			sim.addBox( { x:10, y:10, width:7, height:.3, angle:-0.5, density:0, fillColor:0xff0000 } );
			sim.mouseDrag()
		}
	}
}

Forked