An engaging and informative in-game HUD is a crucial piece of most games. Mobile games, in particular, often blend user input with heads-up information due to the small amount of screen real estate available. In this example, we will create a Minimap to help the player navigate the terrain in the isometric game demo from the last chapter.
Execute the following code:
#import "Minimap.h" @implementation Ch5_Minimap -(CCLayer*) runRecipe { //Initialize the Minimap object minimap = [[[Minimap alloc] init] autorelease]; minimap.position = ccp(300,140); [self addChild:minimap z:10]; //Run our top-down isometric game recipe [super runRecipe]; //Add trees as static objects for(id t in trees){ GameObject *tree = (GameObject*)t; [minimap addStaticObject:ccp(tree.body->GetPosition().x, tree.body->GetPosition().y)]; } return self; } ...