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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T07:40:29+00:00 2026-06-10T07:40:29+00:00

I want to move my body continuos when i touch screen and stop when

  • 0

I want to move my body continuos when i touch screen and stop when i release touch.
I am using box2d and cocos2d and i really dont know why my code cant not perform very well.
i an using touchesBegan for sprite body movement

   -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event 
    {
        ccTime dt;
        UITouch *touch = [touches anyObject];
        CGPoint location = [touch locationInView: [touch view]];
         location=[[CCDirector sharedDirector]convertToGL:location];
        [self moveRight:dt];

    //    [self doWhateverYouWantToDo];
    //    [self doItWithATouch:touch];
    }
-(void)moveRight:(ccTime)dt
{
    CCSprite *ballright=(CCSprite *)ballbody->GetUserData();
    NSLog(@"Ball PositionX: %f",ballbody->GetPosition().x);
     NSLog(@"Ball PositionY: %f",ballbody->GetPosition().y);
    [ballright runAction:[CCMoveTo actionWithDuration:1 position:ccp(ballbody->GetPosition().x,ballbody->GetPosition().y+5*dt)]];

}

So if its wrong than please tell me write logic and code
Please Help me.

Thanks

  • 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-06-10T07:40:31+00:00Added an answer on June 10, 2026 at 7:40 am

    Apply LinearImpuls or LinearVelocity for movement of sprite Body in ccTouchBegan and in ccTouchEnd apply velocity to zero for stop sprite.

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

Sidebar

Related Questions

I am using box 2d. I just want to move my body to the
I want to drag and drop body with its sprite using touch. I do
I want to move an image within a circle with my touch on move.
i want to move a table to a new filegroup. Using the accepted answer
I want to move some file to other place, using Java SE 1.6 So,
I am using this site. Aim : I want to move my footer based
How can I move an element to the end of the body? Using jQuery,
so I have this dynamic body, that I just want to know when an
I want to move same marker after submit the button. I have a code
I'm using this tutorial to create a full screen background. I want my content

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.