0

I am creating an iphone application and for some reason, the instructions are not coming up when I run the code. This is my instructions class. When I run the program, nothing shows up.

Shouldn't "The object of this game is" show up on the screen?

Thank you for whatever help/knowledge you can provide me :)

#import "Instructions.h"
#import "MainMenu.h"

@implementation Instructions

+ (CCScene *) scene
{
    CCScene * scene = [CCScene node]; // scene is an autorelease object
    Instructions * layer =  [Instructions node]; // later is an autorelease object
    [scene addChild: layer]; // add layer as a child to scene
    return scene; // return the scene
}

- (id) init
{
    if ( ( self = [super init] ) )
    {
        [ self how ];
    }
    return self;
}

- (void) how
{
    NSLog(@"The object of this game is ");
}
@end
Surz
  • 984
  • 3
  • 11
  • 36

1 Answers1

0

NSLog does nothing on the screen. It just prints your text in Xcode's console.

To display text in the screen, try making a label. Like this:

- (void) how
{
    // Create the label
    CCLabelTTF *label = [CCLabelTTF labelWithString:@"The object of this game is..." fontName:@"Arial" fontSize:30];

    // Position it on the screen
    label.position = ccp(160,240);

    // Add it to the scene so it can be displayed
    [self addChild:label z:0];
}

For more about labels: http://www.cocos2d-iphone.org/wiki/doku.php/prog_guide:labels

Saturn
  • 17,888
  • 49
  • 145
  • 271