1
votes

I am developing a game similar to the angry birds in AndEngine using the Box2D extension.

My goal is for the animated sprite to jump (like in angry birds) and have it bounce multiple times, depending on the force applied by a user touch event. I am attempting to do this as follows:

private static float mImpulseY = 10f;
private static float mLinearVelocityX = 8.0f;
_playerBody.setLinearVelocity(mLinearVelocityX, _playerBody.getLinearVelocity().y);  
_playerBody.applyLinearImpulse(0,mImpulseY,_playerBody.getPosition().x,_playerBody.getPosition().y);

The jump is creating the proper parabola shape, but it is not bouncing multiple times. Please suggest how I can overcome this problem. Any tutorial links regarding Box2D physics and AndEngine would also be appreciated.

1
Do you tried adjusting b2FixtureDef::restitution parameter of the bird and of the ground? Values near to 1 should provide desired effect of multiply bouncing. - Pavel

1 Answers

0
votes

When you create the Body Object with the FixtureDef object, have you tried setting the elasticity parameter in FixtureDef?