1
嗨矩形的重複這個問題,但我不能找出我做錯了..我在cocos2d一個小白......讓周圍的精靈在cocos2d對不起
這裏是我的頭文件:
#import "cocos2d.h"
#import "Mice.h"
// HelloWorld Layer
@interface PlayScreen : CCLayerColor
{
enter code here
Mice *mice ;
CGRect screenSize;
CCSprite *background ;
CCSprite *objectsBoundry;
CCSprite *scoreBoundry ;
}
//返回包含HelloWorld作爲獨生子女
+(id) scene;
@property (retain,nonatomic)Mice *mice;
@property (retain,nonatomic)CCSprite *background;
@property (retain,nonatomic)CCSprite *objectsBoundary;
@property (retain,nonatomic)CCSprite *scoreBoundary;
- (void)rotateEnemy:(Mice *) pSprite;
- (CGRect)rectMake ;
@end
場景,這是我實現文件
-(id)init{
if((self=[super init])) {
mice = [Mice spriteWithFile:@"mice.png" ];
CGRect * micerec = [mice rectMake];//gives an error here that mice may not respond //to method rectMake
}
return self;
}
-(CGRect)rectMake {
CGRect aRect = CGRectMake((self.position.x-self.contentSize.width/2),
(self.position.y-self.contentSize.height/2),
self.contentSize.width,self.contentSize.height);
return aRect;
}
不明白什麼是錯..感謝您的幫助
對不起哥們...還是同樣的錯誤不能訪問的方法:( –
@Gaurav_soni我現在看到問題了,我已經更新了我的答案。 –