2011-07-02 80 views

回答

1
- (void)ccTouchesMoved:(NSSet *)touches withEvent:(UIEvent *)event{ 
{ 
     //Add a new body/atlas sprite at the touched location 
     for(UITouch *touch in touches) { 

      CGPoint location = [touch locationInView: [touch view]]; 
      location = [[CCDirector sharedDirector] convertToGL: location]; 

      b2Vec2 locationWorld = b2Vec2(location.x/PTM_RATIO, location.y/PTM_RATIO); 

      CCSprite *mist=[CCSprite spriteWithFile:@"bubble.png"]; 
      mist.position=ccp(location.x,location.y); 

      [self addChild:mist]; 
     } 
} 
+0

什麼所有類都需要導入。目前cocos2d.h是唯一導入的類。 –

+0

的#define PTM_RATIO 32 –

+0

#進口 「Box2D.h」 #進口 「GLES-Render.h」 –

0

您需要用touchdispatcher我想註冊...([層registerWithTouchDispatcher])

[glView setMultipleTouchEnabled:YES]; (也許這是需要刷卡)