I'm sorry that was my fault, in my code it was called detonatebackButton , I tried to rename them all for you to backButton , and must have left the detonate in there. Just have it be backButton instead of detonatebackButton. on your error line
Add sprite
(162 posts) (19 voices)-
Posted 1 year ago #
-
Oh ok, thanks!
Posted 1 year ago # -
I tried taking out detonate but the same thing happened. Oh, by the way, do I need this line of code?
backButton.position = ccp( 15, 15 );
I don't even know where 15, 15 is. I just wanted to see if putting it there would make a difference. I tried building and running with and without that line and the same thing always happens.Posted 1 year ago # -
Yeah the .position = ccp( screen X position , screen y position) is for changing the position of that object. I think by default everything is created at ( 0, 0 ) . Leaving it at (0,0) would be pointless since it would be in a corner, so it's your job to make sure it's positioned in a easy to reach area.
Posted 1 year ago # -
Ok, but what should I do about the fact that my app isn't actually launching? I think maybe it's just a small error like missing a ; or ]. I'll double check to make sure it's not one of those small mistakes. Oh, by the way, what position should I put that sprite in ( i mean x and y axis ) for it to be in the bottom left corner? That's where I want the back arrow/button to be. Also, what size should it be? I just made it 50x50.
Thanks for your help!Posted 1 year ago # -
I double checked HelloWorldScene.m and I couldn't find any mistakes. IDK why it would be in any other file, as they were fine before I tried to add a back button, and that I haven't changed anything since then.
Posted 1 year ago # -
Maybe I showed put it in my Developers.m and About the Developers.m files because that's where I want the button to appear.
Posted 1 year ago # -
I meant Developers.m and HelloWorldScene.m in my last post. Anyways, I tried that, and here's what happened. It wasn't too successful.

I didn't know what to replace the line with CCMenu with, so I just kept it the same.Posted 1 year ago # -
Make sure you're passing items to the menu as a
va_list. Also, check your curly brackets. You have them extra brackets in some places, and not enough brackets in other places. There's also a return statement in the middle of no where.Posted 1 year ago # -
Thanks Robo. Although I'm not entirely sure what a va_list is. Could you explain that for me? I'll check my curly brackets.
Posted 1 year ago # -
It can be thought of as a dynamic number of arguments separated by commas. For example:
CCMenu *menu = [CCMenu menuWithItems:firstItem, secondItem, thirdItem, nil];Posted 1 year ago # -
You put the
return self;in the wrong spot it needs to be above the curly bracket that's above it
Also you have an extra curly bracket... 2nd to bottom line
Posted 1 year ago # -
Ok thanks guys. I'll try those tips out tomorrow, I'm really busy today.
Posted 1 year ago # -
@robodude666
can you use " CCMenu " when all I want on the screen is an arrow that will go back to the menu? also, this will be in the developers and instructions pages.Posted 1 year ago # -
@Joethemonkey101 yes, in fact I dont even think a CCMenuItem will work without a CCMenu... I am not sure, haven'e tested it in new versions of cocos2d... But, I think that would be the way to go
Posted 1 year ago # -
Ok, I did all the steps you guys told me about, and here's what I end up with. 1 warning, but when I build and run, the main menu is fine, but when i click on About the Developers, the app just crashes and goes back to the home of the iphone sim.

Also, what does " (menuCallBack) " mean?Posted 1 year ago # -
Why does it say unused variable menu when I use it in the same line?
Posted 1 year ago # -
You create it, but after creation you don't use it ;)
Posted 1 year ago # -
I thought I did use it because I said menuWithItems. If that doesn't count, where would I use it it?
Posted 1 year ago # -
Here's another question. I want to add a title to my main menu. How do I do that? I made a CCLabel on the menu, but I want it to be on the top, not with the list of scenes. Also, what do I do in the -(void) method??? I don't want it to be touchable, but I forgot the code for that. Something like enableTouches:NO ?
Posted 1 year ago # -
How did you setup the label? You can create a label as normal. Add it as a child to your menu layer and set it's position to be where you want it.
Posted 1 year ago # -
There aren't any errors, it's just that it seems that the button is clickable. I named it " title " because that's what it is.
Posted 1 year ago # -
@Joethemonkey101 you don't want your title to be a CCMenuItem.... You should just add the CCBitmapFontAtlas named title to the game:
[self addChild:title];Posted 1 year ago # -
The label isn't the main thing, i just thought about it as a side note. What I really want is to finish with that back button.
Posted 1 year ago # -
Thanks Techy, I'll try that as well
Posted 1 year ago # -
Create a CCMenuItem for the back button, add it to a CCMenu and add the CCMenu to the scene and position it and set up the methods
Posted 1 year ago # -
Thanks. The CCLabel worked. I'll try the backbutton
Posted 1 year ago # -
I'm not really sure how to set up a CCMenuSprite. Here's what I got so far.
Posted 1 year ago # -
@Joethemonkey101 not quite...
Posted 1 year ago #
Topic Closed
This topic has been closed to new replies.