Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void addFace(final float pX, final float pY) {
- this.mFaceCount++;
- Debug.d("Faces: " + this.mFaceCount);
- final AnimatedSprite face;
- final Body body;
- if(this.mFaceCount % 4 == 0) {
- face = new AnimatedSprite(pX, pY, this.mBoxFaceTextureRegion, this.getVertexBufferObjectManager());
- body = PhysicsFactory.createBoxBody(this.mPhysicsWorld, face, BodyType.DynamicBody, FIXTURE_DEF);
- } else if (this.mFaceCount % 4 == 1) {
- face = new AnimatedSprite(pX, pY, this.mCircleFaceTextureRegion, this.getVertexBufferObjectManager());
- body = PhysicsFactory.createCircleBody(this.mPhysicsWorld, face, BodyType.DynamicBody, FIXTURE_DEF);
- } else if (this.mFaceCount % 4 == 2) {
- face = new AnimatedSprite(pX, pY, this.mTriangleFaceTextureRegion, this.getVertexBufferObjectManager());
- body = PhysicsExample.createTriangleBody(this.mPhysicsWorld, face, BodyType.DynamicBody, FIXTURE_DEF);
- } else {
- face = new AnimatedSprite(pX, pY, this.mHexagonFaceTextureRegion, this.getVertexBufferObjectManager());
- body = PhysicsExample.createHexagonBody(this.mPhysicsWorld, face, BodyType.DynamicBody, FIXTURE_DEF);
- }
- face.animate(200);
- this.mScene.attachChild(face);
- this.mPhysicsWorld.registerPhysicsConnector(new PhysicsConnector(face, body, true, true));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement