Andengine/Box2d placing objects - help.

Problems with Canvas, OpenGL, etc...

Andengine/Box2d placing objects - help.

Postby OzLark » Fri Feb 03, 2012 12:03 am

Hi All,

I'm trying to write a game that uses the andengine box2d extensions but am having trouble placing objects in he scene without them 'bouncing' around.

Imagine I want to build a scene like Angry Birds where there are blocks that are in place and need to be knocked over or similar. My problem is that any objects I place in my scene seems to 'bounce' when they are placed on top of another object. I don't want these to move unless something hits them.

How do I place stationary items in my scene without them 'bouncing' so I can build structures out of blocks?

I'm using simple sprites like such:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. this.mBlockTextureAtlas = new BitmapTextureAtlas(32, 256, TextureOptions.BILINEAR);
  2. this.mBlockTextureRegion = BitmapTextureAtlasTextureRegionFactory.createFromAsset(this.mBlockTextureAtlas, this, "block.png", 0, 0);
  3.  
Parsed in 0.032 seconds, using GeSHi 1.0.8.4

then:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. block = new Sprite(pX, pY, width, height, this.mBlockTextureRegion, this.getVertexBufferObjectManager());              
  2. body = PhysicsFactory.createBoxBody(this.mPhysicsWorld, block, BodyType.DynamicBody, objectFixtureDef);
  3.  
  4. this.scene.attachChild(block);
  5. this.mPhysicsWorld.registerPhysicsConnector(new PhysicsConnector(block, body, true, true));
  6.  
Parsed in 0.031 seconds, using GeSHi 1.0.8.4


Now this block is being placed on top of a static sprite but it still 'bounces' when the scene is activated..

This is driving me crazy! Any ideas?
OzLark
Junior Developer
Junior Developer
 
Posts: 23
Joined: Sat Jul 09, 2011 7:26 am

Top

Return to Android 2D/3D Graphics - OpenGL Problems

Who is online

Users browsing this forum: No registered users and 3 guests