first of all i am new to Cocos2D and Obj-C so i do encounter maybe simple problems like this. my problem looks like this: there is a sprite on the screen and the user will have to touch the top of it and while still pressed move a bit upwards and then release the touch. imagine a player sprite with a hat, where you have to touch the hat and move your finger a bit towards to top to make his hat fly into that direction. whats the best way to realize this?
what i got so far is this:
- (void)ccTouchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch *touch = [touches anyObject];
CGPoint location = [touch locationInView:[touch view]];
location = [[CCDirector sharedDirector] convertToGL:location];
//other stuff
}
do i need to create another method to determine the CCTouchesBegan location and then give that values to the CCTouchesEnded method, where i then calculate the angle and make the hat fly away? or can i determine the position where the touch began in the above method itself?
Thank you very much for any answer :)