Domanda

im trying to create a gameover view in my sprite builder project. i have 2 problems. firstly when i copy an image to the Gameover.ccb xcode throws an error saying it cannot find that image.I dont understand this because the file is located exactly where xcode says it cant find it.

cocos2d: Couldn't find file:ccbResources/apple.jpg

Second problem is ive created a button in my GameOverScene.ccb. ive assigned the doc root var to "_restartGameover" and i have selected the selector as "resgame" with target document root. then in my GameOverScene.m on xcode i have the following code

    "#import "GameOverScene.h"

@implementation GameOverScene{
CCButton *_restartGameover;
}



- (void)resgame {
    [CCBReader loadAsScene:@"MainScene"];
}
@end" 

but when i run the project in xcode and click the button, i get an error saying "Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[CCNode resgame]: unrecognized selector sent to instance 0x14d6ffa0'". If anyone could help me with this i would be grateful as ive been stuck on it for a few hours now. Also i am fairly new to this so if you could clearly explain your solutions that would also be great.

http://tinypic.com/r/29mom7n/8

so thats my spritebuilder screen, when i run the xcode project the ccnodegradient and ccbutton are displayed but not the apple.jpg. and when the ccbutton is pressed it throws that error

È stato utile?

Soluzione

In SpriteBuilder, you need to set your scene class to GameOverScene. This is likely why you're getting an error about the unrecognized selector (your error message suggests that it's trying to call the method on a CCNode instead of your subclass).

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top