objective c - Cocos2d: Touch handling changing coordinate system -
i have layer called gameplay layer handler of tilemap in game, , layer add player , add player controllayer player class can controlled player. add controllayer child of class (gameplay layer) problem coordinates touches (cctouchesbegan...) becomes in same coordinates tilemap width , height. want controllayer independent , have normal 480x320 coordinates, how can fix this?
controllayer = [[diggamecontrollayer alloc]initwithobjectforplayercontrol:player]; [self addchild:controllayer]; - (void)cctouchesbegan:(nsset *)touches withevent:(uievent *)event { (uitouch *t in touches) { cgpoint touchlocation = [self converttouchtonodespace:t];
i´m gonna answer own question, using locationinview of touch´s own view works enough
- (void)cctouchesbegan:(nsset *)touches withevent:(uievent *)event { (uitouch *t in touches) { cgpoint touchlocation = [t locationinview:t.view];
Comments
Post a Comment