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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T10:59:35+00:00 2026-05-21T10:59:35+00:00

Hi i am trying to create a game like bucket ball, i am using

  • 0

Hi i am trying to create a game like bucket ball,

i am using box2d as physics engine with UIView in iPhone,
i create world and add object into it.
set every thing fine.

but i don’t know how can i draw starching and bouncing when user release starching. (see image for)

Please if any one has work around.

Thanks.!
Here is Screen Short

  • 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-21T10:59:36+00:00Added an answer on May 21, 2026 at 10:59 am

    i solved this by following code. declare mutable array.

    NSMutableArray *arrTouches;
    
    - (void)ccTouchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
    {
        if([[touches allObjects] count] == 1)
        {
            if([arrTouches count]==2)
            {
                UITouch *touch = [[touches allObjects] objectAtIndex:0];
                CGPoint location = [touch locationInView: [touch view]];
                location = [[CCDirector sharedDirector] convertToGL: location];
                [arrTouches replaceObjectAtIndex:1 withObject:NSStringFromCGPoint(location)];
                [self jumpBall];
            }
        }
    }
    
    - (void)ccTouchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
    {
        if([[touches allObjects] count] == 1)
        {
            if([arrTouches count] == 1)
            {
                UITouch *touch = [[touches allObjects] objectAtIndex:0];
                CGPoint location = [touch locationInView: [touch view]];
                location = [[CCDirector sharedDirector] convertToGL: location];
                [arrTouches addObject:NSStringFromCGPoint(location)];
            }
            else if([arrTouches count] == 2)
            {
                UITouch *touch = [[touches allObjects] objectAtIndex:0];
                CGPoint location = [touch locationInView: [touch view]];
                location = [[CCDirector sharedDirector] convertToGL: location];
                [arrTouches replaceObjectAtIndex:1 withObject:NSStringFromCGPoint(location)];
            }
        }
    }
    
    - (void)ccTouchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
    {
        UITouch *touch = [[touches allObjects] objectAtIndex:0];
        CGPoint location = [touch locationInView: [touch view]];
        location = [[CCDirector sharedDirector] convertToGL: location];
    
        if([[touches allObjects] count] == 1 && CGRectContainsPoint(_ball.boundingBox, location))
        {
            NSLog(@"Touch Begin : X: %f Y: %f",location.x,location.y);
            [arrTouches addObject:NSStringFromCGPoint(location)];
        }
    }
    
    -(void)jumpBall
    {
        CGPoint diff = ccpSub(CGPointFromString([arrTouches objectAtIndex:0]), CGPointFromString([arrTouches objectAtIndex:1]));
    
        CGPoint oldP = CGPointFromString([arrTouches objectAtIndex:0]);
        CGPoint newP = CGPointFromString([arrTouches objectAtIndex:1]);
    
        CGPoint p = CGPointFromString([arrTouches objectAtIndex:1]);
    
        float floatX = p.x/PTM_RATIO;
        float floatY = p.y/PTM_RATIO;
    
        _body->ApplyForce(b2Vec2(-5.0f*diff.x,5.0f*newP.y), _body->GetPosition());
    
        [arrTouches removeAllObjects];
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to create a word search game (kind of like Wordament but much
I am trying to create a game in using wp7 ( windows phone 7
I am trying to create a PBBG (persistent browser based game) like that of
I am trying to create a pacman-like game. I have an array that looks
So I am trying to create a real simple dice game...more like a dice
I am trying to create an app like a CutTheRope. In My game,if i
I'm trying to create an HTML5 game, which I'd like to work in modern
I am trying to create a memory game in Java. Something like this, but
I'm trying to create a scrabble-solver to run stress-tests on a scrabble-like game I'm
I am trying to create a database table for my game, and would like

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.