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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 19, 20262026-06-19T00:02:34+00:00 2026-06-19T00:02:34+00:00

Through help and suggestions, I created a path for my sprite so that only

  • 0

Through help and suggestions, I created a path for my sprite so that only the non-transparent parts can be touched. This is the path I came up with:

    path = CGPathCreateMutable();
    CGPathMoveToPoint(path, NULL, endTouch.x, endTouch.y);
    CGPathAddLineToPoint(path, NULL, 0, 250);
    CGPathAddLineToPoint(path, NULL, 30, 0);
    CGPathCloseSubpath(path);

This works for all my other classes except for one. No matter where I tap, xcode keeps printing “outside” using this code:

for(int i = 0; i < [sprArray count]; i++)
{
    CCSprite *sprite = (CCSprite *)[sprArray objectAtIndex:i];
    if(CGRectContainsPoint([sprite boundingBox], location))
    {
        selectedSprite = sprite;
        location = [selectedSprite convertToNodeSpace:location];
        if (CGPathContainsPoint(path, NULL, location, NO) ) 
        {
            NSLog(@"inside");
        }
        else 
        {
            NSLog(@"outside");
        }

        break;
    }
}

I can only move my sprites if I get inside the if-condition, not else but even if I tap on the actual, colored sprite, it doesn’t get the path I set. Are my measurements wrong? If not, what am I doing wrong? This is similar to the image I’m trying to use…

sample

  • 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-19T00:02:35+00:00Added an answer on June 19, 2026 at 12:02 am

    This works only if image size is same. Depending on image size calculate coordinates.

    enter image description here

    CGPathMoveToPoint(path,    NULL,   54, 0 ); //1: 54 = distance from left, 0 = dis fem bottom
    CGPathAddLineToPoint(path, NULL,   28, 34 );
    CGPathAddLineToPoint(path, NULL,   36, 76 );
    CGPathAddLineToPoint(path, NULL,   51, 104 );
    CGPathAddLineToPoint(path, NULL,   46, 147 );
    CGPathAddLineToPoint(path, NULL,   67, 147 );
    CGPathAddLineToPoint(path, NULL,   70, 105 );
    CGPathAddLineToPoint(path, NULL,   56, 66 );
    CGPathAddLineToPoint(path, NULL,   52, 42 );
    CGPathAddLineToPoint(path, NULL,   67, 20 );
    CGPathAddLineToPoint(path, NULL,   92, 0 );
    CGPathCloseSubpath(path);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can Any one help me reading this XML and Looping through <MedicationDispensed> I get
Can any one help me, i already checked resizing demo but this work through
Can anybody help me how to run a python script through command line? My
With some help from SO, I have a bit of javascript/jquery that cycles through
could someone help me on this problem, i want to access facebook API through
I went through a document at Adobe Livedocs that describes working with pdf: http://livedocs.adobe.com/flex/3/html/help.html?content=PDF_1.html
I am hoping that someone can help me further in my application. Here is
Can anyone help me change this code back to a simple for loop? public
Can someone help me improve on this? There has to be a better way.
Need some help with Activerecord Querying in a has_many :through association. Model: Job class

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.