RPG Game loop and class structure (cocos2D for iPhone)

Posted by mac_55 on Stack Overflow See other posts from Stack Overflow or by mac_55
Published on 2010-03-27T00:12:21Z Indexed on 2010/03/27 0:13 UTC
Read the original article Hit count: 691

I'm looking to make an RPG with Cocos2D on the iPhone. I've done a fair bit of research, and I really like the model Cocos2D uses for scenes. I can instantiate a scene, set up my characters etc. and it all works really nicely... what I have problems with is structuring a game loop and separating the code from the scenes.

For example, where do I put my code that will maintain the state of the game across multiple scenes? and do I put the code for events that get fired in a scene in that scene's class? or do I have some other class that separates the init code from the logic?

Also, I've read a lot of tutorials that mention changing scenes, but I've read none that talk about updating a scene - taking input from the user and updating the display based on that. Does that happen in the scene object, or in a separate display engine type class.

Thanks in advance!

© Stack Overflow or respective owner

Related posts about iphone

Related posts about cocos2d