Spawning bullets on command in Box2D
- by recharge330
I'm making a simple bullet hell game but I can't figure out how to get my character to shoot. Lets say I have bulletBody and shipBody, how would I continually spawn bulletBodies using the shipBody coordinates. I've tried a function that uses an array of b2bodies and just assigns them the bodydef and fixture but that causes the game to crash. C++ sample code would be best but any help is appreciated.
EDIT: It looks like any reference to my b2World in a function will cause the game to crash. How do I declare the bodies without using a b2World as an argument in the function.