已知一个星星的定义:
    star1 =[CCSprite spriteWithFile:@"x_unfilled.png"];
    star1.position = ccp(30+star1.contentSize.width, 240);
 
 
怎么设计能让它在触摸屏幕后出现(这张图片)。
我要完整的程序来观察一下代码的规律.   
ios触摸屏设计

解决方案 »

  1.   

    在ccTouchBegan方法里调用创建这个星星精灵的方法就好了。
      

  2.   

    首先还要 self.isTouchEnabled = YES;
      

  3.   

    -(id)init{
          self.isTouchEnabled=YES;
    }
    -(BOOL)ccTouchBegan:(UITouch *)touch withEvent:(UIEvent *)event{
        CGPoint touchLocation = [self convertTouchToNodeSpace:touch];   
           star1 =[CCSprite spriteWithFile:@"x_unfilled.png"];
        star1.position = ccp(30+star1.contentSize.width, 240);
        CCLOG(@"%f,%f",touchLocation.x,touchLocation.y);
        return YES;
    }