Make Proper bullets with Box2D

Started by
1 comment, last by EyalD 9 years, 5 months ago

Hello,

i am developing an android game with libgdx and box2d. I made a simple enemy that walks towards the player.

I can shoot bullets and move the bullets like this:


body.applyForce(m_impulse,body.getWorldCenter(),true); // This is applied only once

This moves the bullet straight forward, that is what I want. But when the ( small ) bullet hits an enemy, he gets thrown back like 100kilometers. How can i prevent that?

Advertisement

Decrease the mass of the bullet and decrease the force used to fire the bullet by the same factor.

My current game project Platform RPG
Physically speaking, see if you could change the enemy's mass.

Now speaking according to my personal experience with farsear for xna (which is based on box2d)
If I'm not mistaken you can override the collision event of the enemy. Just make sure you return false and it'll be like the collision never happened (though you could alter the enemy's life attribute and remove the bullet before returning false)

Excuse me for my english and grammar

This topic is closed to new replies.

Advertisement