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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T09:17:34+00:00 2026-05-20T09:17:34+00:00

I have a home button on my scene which when pressed goes to the

  • 0

I have a home button on my scene which when pressed goes to the home menu. I use replaceScene to replace the current scene (Game Scene) with the HomeMenu Scene. For some reason the actions and sounds which are happening in the game scene are not stopped when I replace the scene. I have tried the following code but still when I am in the home menu I can hear the actions and sounds of the game scene playing.

// fired when the home menu is
clicked!
-(void) homeMenuClicked:(CCMenuItem *) item { NSLog(@”home menu clicked!”);

CCScene *scene = [[CCDirector
sharedDirector] runningScene]; [scene
stopAllActions];

[self.layer stopAllActions];

[self unloadSoundEffects];

[[CCDirector sharedDirector]
replaceScene:[CCSlideInLTransition
transitionWithDuration:1.0
scene:[HomeScene scene]] ];

}

I must also add that the game layer also has a timer (NSTimer) object which starts in 2 seconds or something.

UPDATE 2:

Let me post some code! I think the problem is that when the player guess the correct answer the following method is invoked:

[self updateForCorrectAnswer];

Inside updateForCorrectAnswer I have a performSelector which is scheduled to fire in 6-7 seconds. I believe that performSelector is the culprit. If somehow can I stop that from being firing then the I think I will be fine.

    [self performSelector:@selector(refreshScore) withObject:nil afterDelay:7.0]; 
  • 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-20T09:17:34+00:00Added an answer on May 20, 2026 at 9:17 am

    You should not use NSTimer as cocos2d documents.

    /* call scheduleUpdate in initializing */
    [self scheduleUpdate];
    

    It schedules update: method to be called every frame when this node is on the stage.

    - (void)update:(ccTime)dt
    {
        /* This method is automatically called every frame. */
    }
    

    scheduleUpdateWithPriority:, schedule:interval: are also available.

    And why don’t you use like this instead of performSelector:withObject:afterDelay.

    [self runAction:[CCSequence actions:[CCDelayTime actionWithDuration:7], [CCCallFunc actionWithTarget:self selector:@selector(refreshScore)], nil]];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a WordPress site (2.6.2) in which I have set the Home page
I have a database for a web application that is home to some personal
Now i have to click the Home button twice and press one app until
when i preess home button there are so many icons are there .i have
I have a menu like so: <div class=header> <ul class=nav> <li><a class=home href=four80eastfan_home.php><img src=Images/home_button.png></a></li>
or How to simulate a home button pressed event? I need to restart my
I have a home project that really needs to be in Source Control. I
At home we have a proxy server. At work we don't. Firefox irritates in
I have lots of home directories under /ifshome on Linux. I want to see
I have taken a copy of a database home with me so I can

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.