Timer and Fadeout

Timer and Fadeout
0.0 0


Hello there Cocos2d X community, this whole project seems AWESOME, if not insane.

And I like insane.

I’ve done my homework, got the whole kit working and figured out how to create new scenes. Went ahead and made myself some class templates.

Now I need your help, if you’d be so kind :3

My first question. I have two scene classes so far

The first is a Splash screen [[http://pastebin.com/HH99su9x]]
* Loads the image
* Fades to black after 4 seconds
* -Tells app delegate to unload it, and load DisclaimerScene

DisclaimerScene [[http://pastebin.com/keUBz83g]]
**prints the EULA
**Creates 2 buttons
* Button 1 closes the program
* Buton 2 sends me to the next page

So where I’m tripped up right now is

  1. how to create a timer/fadeout for my Splash image
  2. How to tell App Delegate what to do

OffTopic, is there an IRC/chat channel this community hangs out in? Any other stuff a new guy should know?
Appreciate the help in advance.


I write a sample code for you.

    // ...
    pFullScreenSprite->runAction( CCSequence::actions( 
                                                   CCCallfunc::actionWithTarget(this, callfunc_selector(SplashLayer::switchToDisclaimerScene)),
                                                   NULL ) );
    // ...

    CCScene* pDisclaimerScene = DisclaimerScene::node();
    CCDirector::sharedDirector()->replaceScene( CCTransitionFade::transitionWithDuration(2.0f, pDisclaimerScene, ccWHITE) );

The tips:
# You can not tell AppDelegate to do, it isn’t the place to write game logics. Just tell CCDirector to do transitions, or tell your layer to do via CCCallfunc
# use CCTransitionFade or CCFadeOut to implement your feature.


Hello, and first off, thanks Walzer for your help, the support is very appreciated.

I’m getting the error ‘CCCallFunc’ has not been declared. I did make sure to use #include “CCActionInstant.h”

I’m sure it’s some simple error but I haven’t figured it out quite yet, I’ll keep you updated, thanks in advance.


CCActionInstant.h, line 172
class CC_DLL CCCallFunc : public CCActionInstant

Your situation is a bit odd… Do you forget the namespace cocos2d:: ? Or you used my type CCCallfunc (‘f’ should be uppercase)