Note that there are some explanatory texts on larger screens.

plurals
  1. POHUD tutorial for cocos2d
    text
    copied!<p>I've tried following this tutorial (http://www.raywenderlich.com/4666/how-to-create-a-hud-layer-with-cocos2d) however as you can probably tell I'm not using the tutorial for the same thing as them, but for an almost identical setup. I believe I've followed it step by step. However i get the error (location shown by arrows: &lt;----) 'Unknown type name 'settingsMenu'' and 'expected a type' respectively: </p> <p>mainMenu.h:</p> <pre><code>// mainMenu.h #import &lt;Foundation/Foundation.h&gt; #import "cocos2d.h" #import "Constants.h" #import "SceneManager.h" #import "settingsMenu.h" @interface mainMenu : CCLayer { settingsMenu * _settings; &lt;---- } @property (nonatomic, assign) BOOL iPad; + (id)scene; - (id)initWithsettingsMenu:(settingsMenu *)settings; &lt;---- @end </code></pre> <p>mainMenu.m: </p> <pre><code>// mainMenu.m #import "mainMenu.h" #import "gameData.h" #import "gameDataParser.h" #import "SimpleAudioEngine.h" #import "settingsMenu.h" @implementation mainMenu @synthesize iPad; + (id)scene { CCScene *scene = [CCScene node]; settingsMenu *settings = [settingsMenu node]; [scene addChild:settings z:1]; mainMenu *menuLayer = [[[mainMenu alloc] initWithsettingsMenu:settings] autorelease]; [scene addChild:menuLayer]; return scene; } </code></pre> <p>settingsMenu.h:</p> <pre><code>// settingsMenu.h #import &lt;Foundation/Foundation.h&gt; #import "cocos2d.h" #import "Constants.h" #import "SceneManager.h" @interface settingsMenu: CCLayer { CCMenuItem *_musicOn; CCMenuItem *_musicOff; CCMenuItem *_invertControlsOn; CCMenuItem *_invertControlsOff; } @property (nonatomic, assign) BOOL iPad; @property (nonatomic, assign) BOOL settings; @end </code></pre> <p>settingsMenu.m:</p> <pre><code>// settingsMenu.m #import "settingsMenu.h" #import "gameData.h" #import "gameDataParser.h" #import "SimpleAudioEngine.h" #import "mainMenu.h" @implementation settingsMenu - (id)init{ if( (self=[super init])) { // Determine Screen Size CGSize screenSize = [CCDirector sharedDirector].winSize; self.iPad = UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad; if (self.iPad){ CCSprite *background = [CCSprite spriteWithFile:@"settingsiPad.png"]; background.position = ccp(screenSize.width/2, screenSize.height/2); [self addChild:background]; } else if (screenSize.height &gt; 490){ CCSprite *background = [CCSprite spriteWithFile:@"settingsiPhoneFive.png"]; background.position = ccp(screenSize.width/2, screenSize.height/2); [self addChild:background]; } else{ CCSprite *background = [CCSprite spriteWithFile:@"settingsiPhone.png"]; background.position = ccp(screenSize.width/2, screenSize.height/2); [self addChild:background]; } [self addButtons]; } return self; } </code></pre> <p>Thanks for your time! I don't think there's any need for posting any more code, but if there is anywhere else that might be causing this problem, please let me know and I'll post the code.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload