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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T13:14:37+00:00 2026-05-28T13:14:37+00:00

hope anyone can help me. I’m trying to figure out what pointer to an

  • 0

hope anyone can help me.
I’m trying to figure out what pointer to an object is passed within a call of a method.

So (in the cocos2d environment) it would be something like this:

- (void)loadCreature:(CCSprite*)creature
{
    if (/*here I want to check if the pointer is 'blue'*/) NSLog(@"the creature is blue")
    if (/*here I want to check if the pointer is 'red'*/) NSLog(@"the creature is red")
}

and the implementation:

CCSprite *blue;
CCSprite *red;

[self loadCreature:blue];
[self loadCreature:red];

thanks in advance 🙂

  • Yurki
  • 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-28T13:14:37+00:00Added an answer on May 28, 2026 at 1:14 pm

    Unless there is some information buried inside of the blue and red objects that differentiates them, ie:

    [blue setDistingusingInformation:@”This is blue”];

    [red setDistingusingInformation:@”This is red”];

    And is set before the call to loadCreature, then there would not be any way to tell inside the loadCreature method which CCSprite object was passed to it.

    The only alternative would to declare red and blue as global variables and inside loadCreature do a comparison of their pointers to figure out which is which. But that would be so wrong to do, and if I found out that you were doing this I’d get very very angry 😀

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

Sidebar

Related Questions

I hope anyone can help me out in this topic, even if it's not
I'm having some problems with my stored procedure. Hope anyone can help me figure
I am stuck and in need of a hand. Hope someone can help? Anyone
Hi i hope someone can help me, i am trying to import XML elements
I hope anyone can help me (Sorry for my english). I have a problem
Hi guys I hope anyone can help me. I'm running a simple program in
I hope anyone from the large community here can help me write the simplest
I hope anyone can help me to fix a little problem. After getting a
I hope anyone can help. I have to develop up against this third party
I'm new here and I hope anyonte can help me. I have WCF Service

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.