Very short and simple, I switch to my new scene and there I have MenuItemImage and Menu. It workds perfectly. My menu item is added to the layer and no problem.
Only when I try to just simply setPosition my Menu item, the whole thing crashes. Means I get bad access when my new scene tries to load up. SIGABRT!
backButtonMenu->setPosition(ccp(10, 10));
in what world a line of code like that would cause the layer which itself is in it, not to even load!
just dont worry about the Arena class its a very simple class which for now puts a background in my layer and it works, before those menu items came to the picture
Well, everything looks ok… Have you tried the usual voodoo - clean the project and remove it from simulator (same way as you would uninstall an app from device) ?
Yes I did that several times, and the funny thing is even without the setPosition, “sometimes” the back and forth process crashes
this really is driving me crazy, what is causing it to crash sometimes!?
I also added a destructor to my Arena class, but no change.
but it will always crash when i use setPosition.
Either im in a bad dream, or cocos2dx has some serious issues
backButtonMenu~~>setPosition);
BUT, this line works:
backButtonMenu~~>setPosition(ccp(size.width-1,size.height-1));
seems like atleast “half” of the menu item should be “inside” the screen maybe? that explains why ccp(10,10) didnt work. because the dimensions of the menu item (precisely its image) divided by 2 are greater than 10. meaning height and width themselves are greater than 20! resulting it to be out the screen by more than half of it, in the bottom left corner when positioned to ccp(10,10).
Thanks for looking into it though I appreciate it. it took about 4 hours of mine.