ios - Moving a sprite by touching anywhere on the screen -
in game 1 sprite responds touches. how can make mousejoint move sprite/body regardless of touch on screen?
- (void)cctouchesmoved:(nsset *)touches withevent:(uievent *)event { uitouch *touch = [touches anyobject]; cgpoint location = [touch locationinview: [touch view]]; location = [[ccdirector shareddirector] converttogl:location]; mysprite.position = location; }
make sure in init
method self.istouchenabled = yes;
Comments
Post a Comment