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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:22:39+00:00 2026-05-26T22:22:39+00:00

In my application I am noticing that there are may things that don’t seem

  • 0

In my application I am noticing that there are may things that don’t seem right in my CCScene.

Ill just explain 3 things:
1. My FPS does not show anywhere in the view even though I do this from my UIViewController (My CCLayer is its own class)

The .h of my CCLayer class looks like this:

@interface CCMyGame : CCLayer {

CCDirector* director = [CCDirector sharedDirector];
    [CCDirector setDirectorType:kCCDirectorTypeDisplayLink];
    [director setAnimationInterval:1.0/60];
    [director setOpenGLView:self.eaglView];
    [director setDisplayFPS:YES];
    [director runWithScene:[CCSceneGame scene]];

I see one CCSprite of mine but thats it, I do not see anything else.

Then in my CCLayer class I do this to fully activate a CCScene:

+(CCScene *) scene
{
    CCScene *scene = [CCScene node];
    CCSceneGame *layer = [CCSceneGame node];
    [scene addChild:layer];
    return scene;
}

Why is this?

  1. My game loops are not getting called.
    I am doing this:

    [self schedule:@selector(myGameLoop:)];

Then in my game loop I NSLog it and the log never shows in the console so I realize that it is not getting called.

Also another thing that is odd is that my UIAccelerometer delegate method is not getting called even though I do this:

self.isAccelerometerEnabled = YES;
    [UIAccelerometer sharedAccelerometer].delegate = self;
    [UIAccelerometer sharedAccelerometer].updateInterval = 0.10f/4.0f;

Any reasons why?

  1. And lastly, none but one of my CCSprites are showing.
    I have a few CCSprites that I add like [self addChild:mySprite]; But I do not see them. They are all attached to b2Bodys and some are animating but I only see one CCSprite and I am not sure why that is the only one I see.

Does anyone have any ideas why any of these things are happening?

Edit1:

#1: Fixed!

#2:
I am doing that and it is still not working!
I do this to schedule it:

[self schedule:@selector(cocosgameLoop:)];

This is my method:

    -(void)cocosgameLoop:(ccTime)delta {
    NSLog(@"cocosgameLoop");
}

That NSLog is not getting called. And when you showed me the second way, that won’t get update like a game loop usually would, that will only make the method called once.
Why is that method not getting called?

Also the strange thing is that my UIAccelerometer delegate method is still not getting called!
I am now doing this:

self.isAccelerometerEnabled = YES;
[UIAccelerometer sharedAccelerometer].updateInterval = 1/30.0f;

And I NSLogged my UIAccelerometer delegate method and it still doesn’t seem like it is getting called:

- (void)accelerometer:(UIAccelerometer *)accelerometer didAccelerate:(UIAcceleration *)acceleration {
    NSLog(@"accelerometer");
}

Edit2: It now seems that my UIAccelerometer method gets called if I do:

[[UIAccelerometer sharedAccelerometer] setDelegate:self];
[[UIAccelerometer sharedAccelerometer] setUpdateInterval:1/60];

Why would this be? I think I read somewhere that my layer is not added to my hierarchy, is that true? I got that idea from here, maybe that is why all these problems are occurring: http://www.cocos2d-iphone.org/forum/topic/13988

#3: My CCSprites are not following a b2Body, instead it is the other way around. You gave me that code here: b2Body Animation?

I am setting the position of my CCSprites like the UIKit way, maybe that is why. Here is an example of one of the sprites that is not getting shown:

CGPoint point = CGPointMake(50, 50);
point = [[CCDirector sharedDirector] convertToGL:point];
[sprite setPosition:point];
[self addChild:sprite z:1 tag:1];
  • 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-26T22:22:39+00:00Added an answer on May 26, 2026 at 10:22 pm

    Missing FPS display: you need to add the “fps_images.png” to your project.


    If you schedule this selector:

    [self schedule:@selector(myGameLoop:)];
    

    Make sure the method is implemented as follows:

    -(void) myGameLoop:(ccTime)delta
    {
    }
    

    The standard way is to just call

    [self scheduleSelector];
    

    and implement:

    -(void) update:(ccTime)delta
    {
    }
    

    It’s a tiny tad faster too.

    Also, use breakpoints to test if a line of code gets called or not. Read this guide if you haven’t been introduced to Xcode debugging.


    By enabling accelerometer AND setting the UIAccelerometer delegate you’re trying to receive accelerometer events through Cocos2D AND via UIAccelerometer. Pick only one:

    self.isAccelerometerEnabled = YES;
    [UIAccelerometer sharedAccelerometer].updateInterval = 1/30.0f;
    

    Also, the updateInterval 10/4 = 2.5 … that means you’re getting accelerometer events at most every 2.5 seconds. You will want this to be a number that’s a fraction of a second, like 0.1 or less.


    If sprites attached to b2Bodies are not visible, check their position. I have a hunch that you forgot to convert from Box2D meter coordinates to pixel coordinates. Try for a test if the sprites appear if they’re not connected to Box2D bodies.

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

Sidebar

Related Questions

I'm noticing that there are double icons for an application I recently built. Is
We have an existing MVC application that we're building using TeamCity and things were
I'm noticing that $config = $this->getOptions(); gets only the settings of the default application.ini
Now that my OpenGL application is getting larger and more complex, I am noticing
I'm using Ninject for a desktop application. I'm noticing that if I exit the
Upon reviewing a bunch of MVC style web applications, I'm noticing that it's common
I started noticing strange behavior when navigating the main toolbar of my Winforms application,
Application : HTA (therefore IE) This is an application that uses SendKeys to populate
Application names on Google Play don't need to be unique, and it's possible to
I have a Symfony app that populates the widgets of a portal application and

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.