Iphone 找不到Cocos2D CGRectIntersect?

Iphone 找不到Cocos2D CGRectIntersect?,iphone,ios,xcode,cocos2d-iphone,Iphone,Ios,Xcode,Cocos2d Iphone,我在Cocos2D(v2.0)中的游戏有问题。我有两个问题(我在代码部分对它们进行了注释)。下面是Bullet.m文件: -(BOOL)checkCollisions:(CGRect)r { BOOL x = NO; if(CGRectIntersectsRect([theGame myRect:self.mySprite],r)) //FIRST ISSUE - Sending 'id' to parameter of incompatible type 'CGRect' (aka 'str

我在Cocos2D(v2.0)中的游戏有问题。我有两个问题(我在代码部分对它们进行了注释)。下面是Bullet.m文件:

-(BOOL)checkCollisions:(CGRect)r
{
BOOL x = NO;

if(CGRectIntersectsRect([theGame myRect:self.mySprite],r)) //FIRST ISSUE - Sending 'id' to parameter of incompatible type 'CGRect' (aka 'struct CGRect'); 
                                                           //SECOND ISSUE - Instance method'-myRect:' not found (return type defaults to 'id') 
{
    x=YES;
    [self reset];
}
return x;
}
在本文件的后面部分:

-(void)update
{
switch (self.whoFired)
{
    case 1:
        [self.mySprite setPosition:ccp(self.mySprite.position.x,self.mySprite.position.y + self.firingSpeed)];

        for(Enemy * s in theGame.enemies)
        {
            if(ccpDistance(self.mySprite.position, s.mySprite.position)<30)
            {
              if([self checkCollisions:[theGame myRect:s.mySprite]]) //FIRST ISSUE - Sending 'id' to parameter of incompatible type 'CGRect' (aka 'struct CGRect')
                                                                     //SECOND ISSUE - Instance method '-damage' not found (return type defaults to 'id')
                {
                    [s damage];
                }
            }
        }
        break;
...
-(无效)更新
{
开关(自燃)
{
案例1:
[self.mySprite设置位置:ccp(self.mySprite.position.x,self.mySprite.position.y+self.firingSpeed)];
用于(游戏中的敌人。敌人)
{

如果(ccpDistance(self.mySprite.position,s.mySprite.position)为什么不能使用CCSprite的默认边界框

if(CGRectIntersectsRect([self.mySprite boundingBox],r))

为什么不能使用CCSprite的默认边界框

if(CGRectIntersectsRect([self.mySprite boundingBox],r))

-myRect:
的原型是否在其声明的类的头文件中?该头文件是否已导入Bullet类的某个位置?头文件已导入。虽然没有创建原型,但我也尝试过使用它,但它也不起作用。
-myRect:
的原型是否在其声明的类的头文件中?and该标头是否已导入Bullet类中的某个位置?标头已导入。虽然未创建原型,但我也尝试过使用它,但它也不起作用。谢谢!它现在起作用了。还有一件事-我收到一些警告,如“对象(敌人、Bullet等)可能不会响应“更新”.Update功能实现正确,一切正常,但我收到了这些警告。如何消除它们?在接口中也定义了相同的警告。谢谢!它现在可以工作了。还有一件事-我收到了一些警告,如“对象(敌人、子弹等)可能不会响应“Update”更新功能实现正确,一切都很好,但我得到了这些警告。如何消除它们?在接口中也定义了相同的。