I was reading the programming guide about touches. I saw that there are 2 different kinds. The game i want to make will probably use multi touching. The standard touch delegate is what I would use right? Where can i learn more in depth about it? I was at this page.
http://www.cocos2d-iphone.org/wiki/doku.php/tips:touchdelegates
Touches
(5 posts) (2 voices)-
Posted 1 year ago #
-
Look up UITouch in the Apple documentation for further information on touches.
Posted 1 year ago # -
Can you use UITouch with cocos2d?
Posted 1 year ago # -
The methods cocos2d provides in the protocol pass a UITouch object as one of the parameters. I suggest looking at some example projects to see how touches are handled in a cocos2d application. It's not hard once you see how it works.
- (void)ccTouchesMoved:(NSSet *)touches withEvent:(UIEvent *)event; - (void)ccTouchesEnded:(NSSet *)touches withEvent:(UIEvent *)event; - (void)ccTouchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event;Example
-(id)init { if(self=[super init]) { //Layer responds to touches self.isTouchEnabled = YES; } return self; } -(void)ccTouchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { //One single touch UITouch *touch = [touches anyObject]; //All active touches NSArray *touches = [touches allObjects]; //The point at which a touch is within a view. CGPoint point = [touch locationInView: [touch view]]; }Posted 1 year ago #
Reply
You must log in to post.