iphone - Multitouch don't work in cocos2d -
this cctouchesmoved method. whats wrong? use cocos2d framework.
-(void) cctouchesmoved:(nsset *)touches withevent:(uievent *)event { ccnode *sprite = [self getchildbytag:ktagplayer]; ccnode *sprite2 = [self getchildbytag:ktagenemy]; cgpoint point; //Собрать все касания. nsset *alltouches = [event alltouches]; (uitouch *touch in alltouches) { point = [touch locationinview:[touch view]]; point = [[ccdirector shareddirector] converttogl:point]; if (point.y > 384) { if (point.x > 992) sprite2.position = ccp(992, size.height - 100); else if (point.x < 32) sprite2.position = ccp(32, size.height - 100); else sprite2.position = ccp(point.x, size.height - 100); } else { if (point.x > 992) sprite.position = ccp(992, 100); else if (point.x < 32) sprite.position = ccp(32, 100); else sprite.position = ccp(point.x, 100); } }
}
have enabled multiple touches in glview? default glview instantiated in app delegate. code below.
[glview setmultipletouchenabled:yes];
Comments
Post a Comment