Hey, basically i'm on my second App for the iPhone SDK and im really enjoying myself. Im currently creating a 'raidan' style 2d game, where the user flys a charac开发者_如何学JAVAter upward and encounters enemies that shoot bullets etc.
The game is coming along well, I have bullets firing, enemies moving (basic), collecting coins and a fuel/shield system, but i'm starting to become abit overwhelmed with the amount of code and i'm wondering if theres a more 'efficient' way to do this.
I have no layers but for the main layer, for example the HUD is on the same layer as the enemies etc. If you would use multiple layers, can RectIntersectRect work between layers?
I have also failed to incorporate custom classes, I'm using NSMutableArray's to put all my objects in.
I suppose this is all abit ambiguous. How would design the architecture for a 2d flight game with multiple levels? Please understand that I have no clue - I simply started writing methods upon methods upon methods.
Between each level - Would you duplicate methods (physics, UIImageView creation etc)?
Thanks for your thought & time
Georg is right, it’s not easy to give a simple answer to your problems. I would suggest that you spend some time reading the Cocos 2D source code. You will learn some basic tricks that you should do to keep the code manageable. All in all it’s a good idea to use some existing game framework if you are starting. It will keep you from reinventing the wheel and cut down on the design choices.
精彩评论