Game Development Reference
In-Depth Information
brick(342,396,16,32);
brick(604,396,16,32);
brick(416,347,16,130);
brick(532,347,16,130);
brick(474,273,132,16);
brick(474,257,32,16);
brick(445,199,16,130);
brick(503,199,16,130);
brick(474,125,58,16);
brick(474,100,32,32);
brick(474,67,16,32);
brick(474,404,64,16);
brick(450,363,16,64);
brick(498,363,16,64);
brick(474,322,64,16);
pig(474,232,16);
var slingCanvas:Sprite=new Sprite();
slingCanvas.graphics.lineStyle(1,0xffffff);
slingCanvas.graphics.drawCircle(0,0,slingR);
addChild(slingCanvas);
slingCanvas.x=slingX;
slingCanvas.y=slingY;
theBird.graphics.lineStyle(1,0xfffffff);
theBird.graphics.beginFill(0xffffff);
theBird.graphics.drawCircle(0,0,15);
addChild(theBird);
theBird.x=slingX;
theBird.y=slingY;
theBird.addEventListener
(MouseEvent.MOUSE_DOWN,birdClick);
addEventListener(Event.ENTER_FRAME,updateWorld);
}
4.
The core of this project now lies in the customContact class, which you will
create in the customContact.as ile:
package {
import Box2D.Dynamics.*;
import Box2D.Collision.*;
import Box2D.Dynamics.Contacts.*;
public class customContact extends b2ContactListener {
private const KILLBRICK:Number=25;
private const KILLPIG:Number=5;
override public function PostSolve(contact:b2Contact,
impulse:b2ContactImpulse):void {
 
Search WWH ::




Custom Search