Long time reader, first time poster.
I can't seem to combine OOP in Objective-C with Box2D. I'm making a zombie game with a bunch of ragdolls, each having 10 bodies. I want to have a "Zombie" class (and subsequent subclasses) to keep them organized because each has slightly different behavior, but as soon as I put my zombie-maker code into a class other than my main game class, the app breaks!
The problem seems to be creating new fixtures from the external class. I can log whether the world is locked in the Zombie class, and it says no, but if I try to create a fixture on the next line the app crashes saying that the world is locked! Bah!
I made another game before and worked around this by putting all my code for the whole game in one, massively ugly class. Ideally, I wouldn't have to do that again.
Maybe I'm managing this the wrong way. So I guess my question comes down to this- how do I manage box2d bodies using OOP without having 10,000 lines of code in my main class?
I can't seem to combine OOP in Objective-C with Box2D. I'm making a zombie game with a bunch of ragdolls, each having 10 bodies. I want to have a "Zombie" class (and subsequent subclasses) to keep them organized because each has slightly different behavior, but as soon as I put my zombie-maker code into a class other than my main game class, the app breaks!
The problem seems to be creating new fixtures from the external class. I can log whether the world is locked in the Zombie class, and it says no, but if I try to create a fixture on the next line the app crashes saying that the world is locked! Bah!
I made another game before and worked around this by putting all my code for the whole game in one, massively ugly class. Ideally, I wouldn't have to do that again.
Maybe I'm managing this the wrong way. So I guess my question comes down to this- how do I manage box2d bodies using OOP without having 10,000 lines of code in my main class?