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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T09:22:00+00:00 2026-06-01T09:22:00+00:00

I am developing ‘ Paper Toss’ for iphone using cocos2d & I would like

  • 0

I am developing ‘Paper Toss' for iphone using cocos2d & I would like to know that how to implement 3D perspective view into this,because while we are throwing the paper ball to the bin,we have to get the 3D feel.I’am attaching the code which i have done,using this i have got a straight line motion.Please help me..

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

// Choose one of the touches to work with
UITouch *touch = [touches anyObject];
CGPoint location = [touch locationInView:[touch view]];
location = [[CCDirector sharedDirector] convertToGL:location];

// Set up initial location of projectile
CGSize winSize = [[CCDirector sharedDirector] winSize];
CCSprite *projectile = [CCSprite spriteWithFile:@"ball.png" 
                                           rect:CGRectMake(0, 0, 40, 40)];
projectile.position = ccp(winSize.width/2,20);

// Determine offset of location to projectile
int offX = location.x - projectile.position.x;
int offY = location.y - projectile.position.y;

// Bail out if we are shooting down or backwards
if (offY <= 0) return;

// Ok to add now - we've double checked position
[self addChild:projectile];

// Determine where we wish to shoot the projectile to
int realY = winSize.height + (projectile.contentSize.width/2);
float ratio = (float) offX / (float) offY;
int realX = (realY * ratio) + projectile.position.x;
CGPoint realDest = ccp(realX, realY);

// Determine the length of how far we're shooting
int offRealX = realX + projectile.position.x;
int offRealY = realY + projectile.position.y;
float length = sqrtf((offRealX*offRealX)+(offRealY*offRealY));
float velocity = 480/1; // 480pixels/1sec
float realMoveDuration = length/velocity;

// Move projectile to actual endpoint
[projectile runAction:[CCSequence actions:
                       [CCMoveTo actionWithDuration:realMoveDuration position:realDest],
                       [CCCallFuncN actionWithTarget:self selector:@selector(spriteMoveFinished:)],
                       nil]];
//add to the projectiles array
projectile.tag = 2;
[_projectiles addObject:projectile];

}*

  • 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-01T09:22:01+00:00Added an answer on June 1, 2026 at 9:22 am

    Finally I have completed paper toss using cocos2d.I implemented bezier curve and here it is,

      // Bezier curve control points
      bezier.controlPoint_1 = ccp(location.x-CONTROL_POINT1_X, CONTROL_POINT1_Y);
      bezier.controlPoint_2 = ccp(location.x-CONTROL_POINT2_X, CONTROL_POINT2_Y);
      bezier.endPosition = ccp(location.x-CONTROL_POINT1_X,distance);
    
      // Motion along bezier curve and finally call a function
      [projectile runAction:[CCSequence actions:
                               [CCAutoBezier actionWithDuration:DEFAULT_ACTION_DURATION bezier:bezier],
                               [CCCallFuncN actionWithTarget:self selector:@selector(collisionCheck:)], nil]];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

developing for Android phone(ver 1.5) I would like to know if there is an
Developing for iPhone, I have a collection of points that I need to make
Developing iphone application using makkit framework. I have got the map view integrated in
Developing a simple game for the iPhone, what gives a better performance? Using a
Current developing an iPhone app using jQuery mobile, everything is looking great however when
iam developing iPhone application that allow user to define stations near to him, so
Am developing a genetic algorithm in Java, that like all of them, requires the
Currently developing an application using the newest version of symfony, obtained through PEAR. This
While developing a firefox extension, I create a wizard window from overlay.js using: this.wizard
I´m developing a software in C# that uses static functions from a C++ .dll

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.