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 3801094
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T13:59:42+00:00 2026-05-19T13:59:42+00:00

This is my ccTouchesMoved method. Whats wrong? I use cocos2d framework. -(void) ccTouchesMoved:(NSSet *)touches

  • 0

This is my ccTouchesMoved method.
Whats wrong? I use cocos2d framework.

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

CCNode *sprite = [self getChildByTag:kTagPlayer];
CCNode *sprite2 = [self getChildByTag:kTagEnemy];

CGPoint point;

//Собрать все касания.
NSSet *allTouches = [event allTouches];

for (UITouch *touch in allTouches)
{
    point = [touch locationInView:[touch view]];
    point = [[CCDirector sharedDirector] convertToGL:point];

    if (point.y > 384)
    {
        if (point.x > 992)
            sprite2.position = ccp(992, size.height - 100);
        else if (point.x < 32)
            sprite2.position = ccp(32, size.height - 100);
        else
            sprite2.position = ccp(point.x, size.height - 100);
    }
    else
    {
        if (point.x > 992)
            sprite.position = ccp(992, 100);
        else if (point.x < 32)
            sprite.position = ccp(32, 100);
        else
            sprite.position = ccp(point.x, 100);
    }
} 

}

  • 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-19T13:59:43+00:00Added an answer on May 19, 2026 at 1:59 pm

    Have you enabled multiple touches in your glView? By default the glView is instantiated in the app delegate. The code is below.

    [glView setMultipleTouchEnabled:YES];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

so I got this working: -(void) ccTouchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { UITouch *myTouch =
Does anyone know why it will not rotate the sprite? - (void)ccTouchesMoved:(NSSet *)touches withEvent:(UIEvent
This is an example of the code am using. I use a modified version
I'm just trying to schedule an update method once in ccTouchesMoved, but when I
i'm using cocos2d, however the question is general. i have a class CCNode *scaleLayer
This is a bit of a long shot, but if anyone can figure it
This is starting to vex me. I recently decided to clear out my FTP,
This is kinda oddball, but I was poking around with the GNU assembler today
This might seem like a stupid question I admit. But I'm in a small
This is a difficult and open-ended question I know, but I thought I'd throw

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.