Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6601317
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T18:44:14+00:00 2026-05-25T18:44:14+00:00

I want to be able to enable multitouch for cocos2d. How can I do

  • 0

I want to be able to enable multitouch for cocos2d. How can I do this? I want to test each touch event like my code below. Please help.

-(void) ccTouchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {

UITouch *myTouch = [touches anyObject];
CGPoint location = [myTouch locationInView:[myTouch view]];
location = [[CCDirector sharedDirector] convertToGL:location];
b2Vec2 locationWorld = b2Vec2(location.x/PTM_RATIO, location.y/PTM_RATIO);
CGSize screenSize = [CCDirector sharedDirector].winSize;

if (locationWorld.x >= screenSize.width*2/5/PTM_RATIO && locationWorld.x <= screenSize.width*3.25/5/PTM_RATIO) {
    cannonballTouch1 = 1;
    float force = 6;
    b2Vec2 direction = cannonballBody->GetWorldCenter() - cannonBody->GetWorldCenter();
    b2Vec2 iforce = b2Vec2(1.0f/direction.x * force, 1.0f/direction.y * force);
    NSLog(@"%.2f", direction.y);
    NSLog(@"%.2f", iforce.y);
    b2Vec2 force1 = b2Vec2(0, iforce.y);
    cannonballBody->ApplyLinearImpulse(force1, cannonballBody->GetPosition());
}
if (locationWorld.x > screenSize.width*3.25/5/PTM_RATIO) {
    cannonballTouch2 = 1;
    float force = 6;
    b2Vec2 direction = cannonballBody2->GetWorldCenter() - cannonBody2->GetWorldCenter();
    b2Vec2 iforce = b2Vec2(1.0f/direction.x * force, 1.0f/direction.y * force);
    NSLog(@"%.2f", direction.y);
    NSLog(@"%.2f", iforce.y);
    b2Vec2 force1 = b2Vec2(0, iforce.y);
    cannonballBody2->ApplyLinearImpulse(force1, cannonballBody2->GetPosition());
}
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T18:44:15+00:00Added an answer on May 25, 2026 at 6:44 pm

    this page discribe it pretty well.

    http://developer.apple.com/library/ios/#documentation/EventHandling/Conceptual/EventHandlingiPhoneOS/MultitouchEvents/MultitouchEvents.html

    To handle multitouch events, you must first create a subclass of a responder class. This subclass could be any one of the following:

    A custom view (subclass of UIView)
    A subclass of UIViewController or one of its UIKit subclasses
    A subclass of a UIKit view or control class, such as UIImageView or UISlider
    A subclass of UIApplication or UIWindow (although this would be rare)
    A view controller typically receives, via the responder chain, touch events initially sent to its view if that view does not override the touch-handling methods.

    For instances of your subclass to receive multitouch events, your subclass must implement one or more of the UIResponder methods for touch-event handling, described below. In addition, the view must be visible (neither transparent or hidden) and must have its userInteractionEnabled property set to YES, which is the default.

    The following sections describe the touch-event handling methods, describe approaches for handling common gestures, show an example of a responder object that handles a complex sequence of multitouch events, discuss event forwarding, and suggest some techniques for event handling.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to enable an user to be able to communicate with other users
I want to enable only two columns in the DataGridview to be able to
I want to be able to do: For Each thing In things End For
I want to be able to do this. MyInterface interface = new ServiceProxyHelper<ProxyType>(); Here's
I have a Composite that I want to be able to enable/disable programatically. The
I want to be able to disable the commandbutton below once it's hit and
I want globally enable whitespace-mode. I have tried this in my .emacs: (require 'whitespace)
I want to be able to enable/disable a CRM 2011 Organization using Deployment Service
I want to be able to user query strings in this fashion. Domain.com/controller/function?param=5&otherparam=10 In
I want to modify the code snippet below in such a way, that I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.