Spawning bullets on command in Box2D
        Posted  
        
            by 
                recharge330
            
        on Game Development
        
        See other posts from Game Development
        
            or by recharge330
        
        
        
        Published on 2011-02-19T20:19:44Z
        Indexed on 
            2011/02/19
            23:33 UTC
        
        
        Read the original article
        Hit count: 281
        
box2d
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.
© Game Development or respective owner