Creating a "developer screen" for developing games in cocos2d

I am currently developing a game on the iPhone using the Cocos2D API. Everything goes well. One of the problems I have is that I have to recompile every time I want to change my variables. This is very tiring, especially now, when I adjust the gameplay.

Is there any implementation for a kind of developer console screen? I mean: I want to have the type of game screen that I load, which contains a list of variables that I register on the game screen (with a scroller). And I want to be able to change these variables in place.

I remember that there was a presentation about the WWDC event in which they showed such a screen on the ipad. The developer simply presses the button, and the game screen changes to the developer’s console, for example, the screen. I know this presentation has nothing to do with Cocos2D, but if it already exists in some form or form, I would like to reuse this code instead of writing it myself.

Although, if I had to write it myself, I would not know where to start. So any help would also be appreciated.

thanks!

+4
source share
2 answers

It was (I believe) Graeme Devine at Apple WWDC last year, which had some suggestions on how to implement such a developer console (check out the video at iTunes University). Example A game console is included in the WWDC 2010 code sample (232 MB) . I also added a link (57 kb) to GameConsole.zip from DropBox for convenience.

+4
source

This is a serious answer, but we have implemented a developer console for Mega Run to test various stages and change player properties at runtime. The implementation was to click in the upper left corner of the screen at any time in the game to open the console. From there you can change your needs. The implementation skeleton was to override the EAGLView and handle the TouchBegan touch callback on its own. Here is the implementation ...

-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { const CGFloat DEV_DASHBOARD_ENABLE_TOUCH_AREA = 20.0f; for (UITouch* t in touches) { CGPoint pt = [t locationInView:self]; if (pt.x < DEV_DASHBOARD_ENABLE_TOUCH_AREA && pt.y < DEV_DASHBOARD_ENABLE_TOUCH_AREA) { ToolSelectorContainer* editorViewController = [[ToolSelectorContainer alloc] initWithNibName:@"ToolSelectorContainer" bundle:nil]; if (editorViewController != nil) { CCScene* g = [CCDirector sharedDirector].runningScene; // Pause the game if we're in it playing // if ([g isKindOfClass:[Game class]]) [((Game *)g) menuPause]; [[GSGCocos2d sharedInstance].navigationController pushViewController:editorViewController animated:YES]; [editorViewController release]; break; } } } #endif [super touchesBegan:touches withEvent:event]; } 

ifdef is used to not compile this code for production builds.

0
source

All Articles