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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T02:02:01+00:00 2026-05-21T02:02:01+00:00

I am trying to find collision detection between Two Sprits ( encircle with black

  • 0

I am trying to find collision detection between Two Sprits ( encircle with black color in below picture)

here is the code from which i m trying to find with the help by compairing x cordinate of both sprits but unsuccessful

have a look and tell me what is the mistake

- (void)update:(ccTime)dt {


    NSLog(@"Target y %f, player y %f",target.position.y, player.position.y);
    if(target.position.y==player.position.y)
//          if((target.position.x==player.position.x)&&(target.position.y==player.position.y))
//  if((sprite.position.y==player.position.y)||(sprite.position.y==player.position.y))
    {
                 Nslog (@"Matched");
            //do Something  
    }
}

enter image description here

  • 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-21T02:02:01+00:00Added an answer on May 21, 2026 at 2:02 am

    The CCNode class which is the parent of the CCSprite class has a boundingBox property of type CGRect. Using this property of the player and target objects you can check for collisions using…

    if (CGRectIntersectsRect(player.boundingBox, target.boundingBox) {
        // Kaboom...
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to find a collision between two messages that will lead to
Possible Duplicate: Circle line collision detection I'm trying to do collision testing between a
I am trying to perform broad-phase collision detection with a fixed-grid size approach. Thus,
I'm trying to create a good way to handle all possible collisions between two
I have been trying to find a collision avoidance example that I can adapt
I trying find a simple python-based algorithmic ranking system. Here's the scenario: There will
I am trying find out how to redirect all traffic on a website from
I'm trying find a way to create mysql users with passwords using php code,
I'm trying to find out about the Extras menu on windows phone. Extras.xml. Here
Trying to find some simple SQL Server PIVOT examples. Most of the examples that

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.