Advertisement
Guest User

Untitled

a guest
Jul 1st, 2012
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.28 KB | None | 0 0
  1. private void addFace(final float pX, final float pY) {
  2.         this.mFaceCount++;
  3.         Debug.d("Faces: " + this.mFaceCount);
  4.  
  5.         final AnimatedSprite face;
  6.         final Body body;
  7.  
  8.         if(this.mFaceCount % 4 == 0) {
  9.             face = new AnimatedSprite(pX, pY, this.mBoxFaceTextureRegion, this.getVertexBufferObjectManager());
  10.             body = PhysicsFactory.createBoxBody(this.mPhysicsWorld, face, BodyType.DynamicBody, FIXTURE_DEF);
  11.         } else if (this.mFaceCount % 4 == 1) {
  12.             face = new AnimatedSprite(pX, pY, this.mCircleFaceTextureRegion, this.getVertexBufferObjectManager());
  13.             body = PhysicsFactory.createCircleBody(this.mPhysicsWorld, face, BodyType.DynamicBody, FIXTURE_DEF);
  14.         } else if (this.mFaceCount % 4 == 2) {
  15.             face = new AnimatedSprite(pX, pY, this.mTriangleFaceTextureRegion, this.getVertexBufferObjectManager());
  16.             body = PhysicsExample.createTriangleBody(this.mPhysicsWorld, face, BodyType.DynamicBody, FIXTURE_DEF);
  17.         } else {
  18.             face = new AnimatedSprite(pX, pY, this.mHexagonFaceTextureRegion, this.getVertexBufferObjectManager());
  19.             body = PhysicsExample.createHexagonBody(this.mPhysicsWorld, face, BodyType.DynamicBody, FIXTURE_DEF);
  20.         }
  21.  
  22.         face.animate(200);
  23.  
  24.         this.mScene.attachChild(face);
  25.         this.mPhysicsWorld.registerPhysicsConnector(new PhysicsConnector(face, body, true, true));
  26.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement