How about a Splash Screen !!

How about a Splash Screen !!
0.0 0


well i have searched quite a few sites now and no site knows how to make a splash screen

I want to learn how to have a time specific splash sceen ,like when we run the game first splash screen should appear and after 5 seconds it should fade out(or any other effect) and our Main Menu screen should appear…

Anyone knows how to do this thing ??


Hi, this is very easy to do.
Just put a CCSprite on the screen an call a CCDelayTime.

Here’s my splash screen full code.

#include "HelloWorldScene.h"
#include "OptionsScene.h"
#include "SplashScene.h"
#include "SimpleAudioEngine.h"
#include "RedirectMethods.h"

using namespace cocos2d;
using namespace CocosDenshion;

CCScene* SplashScene::scene() {
    CCScene *scene = CCScene::create();
    SplashScene *layer = SplashScene::create();
    return scene;

bool SplashScene::init() {
    if (!CCLayer::init()) {
        return false;

    CCSize screenSize = CCDirector::sharedDirector()->getWinSize();

    CCSprite* logomarca = CCSprite::create("cocos2dx_logo.png");
    logomarca->setPosition(ccp(screenSize.width / 2, screenSize.height / 2));
    this->addChild(logomarca, 1);

    CCFiniteTimeAction *seq1 = CCSequence::create(CCDelayTime::create(3.0),
                    callfuncN_selector(RedirectMethods::MenuScene)), NULL);


    return true;


I forgot to add the RedirectMethods Class

here it is:

#include "OptionsScene.h"
#include "MenuScene.h"
#include "WinScene.h"
#include "NewShopScene.h"
#include "MundoUmScene.h"
#include "MundoDoisScene.h"
#include "MundoTresScene.h"
#include "HelloWorldScene.h"
#include "RedirectMethods.h"
#include "Utils.h"


void RedirectMethods::MenuScene()
{ CCDirector::sharedDirector()->replaceScene(MenuScene::scene()); }

void RedirectMethods::MundoUmScene()
{ CCDirector::sharedDirector()->replaceScene( MundoUmScene::scene() ); }

void RedirectMethods::MundoDoisScene()
{ CCDirector::sharedDirector()->replaceScene( MundoDoisScene::scene() ); }

void RedirectMethods::MundoTresScene()
{ CCDirector::sharedDirector()->replaceScene( MundoTresScene::scene() ); }

void RedirectMethods::MundoNoScene()
{ CCMessageBox("More Levels will come in next update","Wait..."); }

void RedirectMethods::ShopScene()
{ CCDirector::sharedDirector()->replaceScene( NewShopScene::scene() ); }

void RedirectMethods::OptionsScene()
{ CCDirector::sharedDirector()->replaceScene( OptionsScene::scene() ); }

void RedirectMethods::HelloWorldScene()
{ CCDirector::sharedDirector()->replaceScene(HelloWorld::scene()); }

void RedirectMethods::WinScene()
{ CCDirector::sharedDirector()->replaceScene(WinScene::scene()); }


what about fade-in effect…or any other transitional effect ??


For fading:

CCScene *pScene = MenuScene::scene();


I’ve tried this solution but I get this error

error C2440: 'type cast' : cannot convert from 'void (__thiscall RedirectMethods::* )(void)' to 'cocos2d::SEL_CallFuncN'

When I change to CCCallFunc and callfunc_selector it works ok, but I don’t think this is the correct way to solve it.
Why am I getting this error?


I’m using the HelloWorldScene to show after the splash screen.
To fix I had to change the RedirectMethods and add a CCNode parameter, that fixed the problem.

void RedirectMethods::HelloWorldScene(CCNode* sender)
	CCScene *pScene = HelloWorld::scene();
	CCDirector::sharedDirector()->replaceScene(CCTransitionFlipAngular::create( 0.5f, pScene ));

I have a doubt, should we need to remove the sender with something like
or not?
replaceScene does it for us?