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

  • Home
  • SEARCH
  • 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 8799611
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T00:22:14+00:00 2026-06-14T00:22:14+00:00

Not really sure why I am getting this error but I have looked in

  • 0

Not really sure why I am getting this error but I have looked in the .h file and I can’t seem to come up with the reason xCode is throwing this error:

// on "init" you need to initialize your instance
-(id) init
{
if ((self=[super init])) {
    _batchNode = [CCSpriteBatchNode batchNodeWithFile:@"Sprites.pvr.ccz"]; //1
    [self addChild:_batchNode]; //2
    [[CCSpriteFrameCache sharedSpriteFrameCache] addSpriteFramesWithFile:@"Sprites.plist"]; //3

    _ship = [CCSprite spriteWithSpriteFrameName:@"SpaceFlier_sm_1.png"];  //4
    CGSize winSize = [CCDirector sharedDirector].winSize; //5
    _ship.position = ccp(winSize.width * 0.1, winSize.height * 0.5); //6
    [_batchNode addChild:_ship z:1]; //7
}
return self;
// 1) Create the CCParallaxNode
_backgroundNode = [CCParallaxNode node];
[self addChild:_backgroundNode z:-1];

// 2) Create the sprites we'll add to the CCParallaxNode
_spacedust1 = [CCSprite spriteWithFile:@"bg_front_spacedust.png"];
_spacedust2 = [CCSprite spriteWithFile:@"bg_front_spacedust.png"];
_planetsunrise = [CCSprite spriteWithFile:@"bg_planetsunrise.png"];
_galaxy = [CCSprite spriteWithFile:@"bg_galaxy.png"];
_spacialanomaly = [CCSprite spriteWithFile:@"bg_spacialanomaly.png"];
_spacialanomaly2 = [CCSprite spriteWithFile:@"bg_spacialanomaly2.png"];

// 3) Determine relative movement speeds for space dust and background
CGPoint dustSpeed = ccp(0.1, 0.1);
CGPoint bgSpeed = ccp(0.05, 0.05);

// 4) Add children to CCParallaxNode
[_backgroundNode addChild:_spacedust1 z:0 parallaxRatio:dustSpeed positionOffset:ccp(0,winSize.height/2)];
[_backgroundNode addChild:_spacedust2 z:0 parallaxRatio:dustSpeed positionOffset:ccp(_spacedust1.contentSize.width,winSize.height/2)];
[_backgroundNode addChild:_galaxy z:-1 parallaxRatio:bgSpeed positionOffset:ccp(0,winSize.height * 0.7)];
[_backgroundNode addChild:_planetsunrise z:-1 parallaxRatio:bgSpeed positionOffset:ccp(600,winSize.height * 0)];
[_backgroundNode addChild:_spacialanomaly z:-1 parallaxRatio:bgSpeed positionOffset:ccp(900,winSize.height * 0.3)];
[_backgroundNode addChild:_spacialanomaly2 z:-1 parallaxRatio:bgSpeed positionOffset:ccp(1500,winSize.height * 0.9)];

}

  • 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-14T00:22:16+00:00Added an answer on June 14, 2026 at 12:22 am

    First off, unless C2D somehow magically changes the way return works, you proceed to do a lot of stuff after returning which can never be reached. You’ve just returned; you’ve exited the method. It’s like telling the painter to leave the room he’s working on and go home for the day… then screaming out to nothingness that he should paint the walls red. Actually, you wouldn’t get to scream at all. Here’s an example:

    - (void) foo {
        int x = 10;
        return; //return control to caller
        self->someValue = x; //never done; we've returned
    }
    

    x would be assigned ten and then you would return. Any lines afterwards are meaningless. Second of all, there’s this line here.

     CGSize winSize = [CCDirector sharedDirector].winSize;
    

    It occurs within an if statement. The variable winSize can only be used within the constraints of the if statement you declared it in. It’s “out of scope” of anything else. For example, the following will give the same warning.

    - (void) bar {
        if (0){
            int x = 1;
        }
        int y = x;
    }
    

    Why not place all the stuff below return inside the if loop, right before it closes?

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

Sidebar

Related Questions

I keep getting this error, and I'm not really sure why this isn't working
I'm not sure if I'm missing something really obvious, but I keep getting a
I'm not really sure how to ask this question, but I'll do my best.
I am sure this is really dumb, but I just cant seem to understand
Not really sure how to phrase this other than by example.. Given... DATABASES =
I am not really sure how to word this question, so I did the
I'm not really sure if there is a single problem here or I have
I am not really sure what type of headers these highlighted values are, but
I am not really sure what this method does, or better I am not
This is not exactly a straight-out question because I have just solved it, but

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.