Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How to create a splash (loading) screen in cocos2d for Android?

I need a loading screen that shows my app name and after that the next scene will show automatically.


share|improve this question
up vote 1 down vote accepted

Well, for cocos i have no idea. But I've done this with pure OpenGL-ES, I cant tell exactly how, since it depends in your implementation of Scene, your states, your sprite drawing, etc. But here's a pseudo code of how mine looks like:


    StaticSprite sprite = new Sprite(R.drawable.GameLogo);
    sprite.setPosition(Screen.width / 2 - sprite.width / 2, Screen.height / 2 - sprite.height / 2);

    ScreenFader fader = new ScreenFader(White, 2);
    fader.setRectangle(0, 0, Screen.width, Screen.height);

This will load your texture, put the logo in the center of the screen, register it to draw, create a ScreenFader(explain later) with a white color that would take 2 seconds to finsih, make the ScreenFader take the whole screen and register the ScreenFader to draw also.

The ScreenFader look like:

class ScreenFader
    float curTime;
    float endTime;
    boolean finished;
    Color color;
    ScreenFader(Color color, float endTime)
        //some code to initialize vertices of a quad here
        //some code to attach color to vertices
        curTime = 0;
        this.endTime = endTime;
        this.color = color;

    SetRectangle(int x, int y, int width, int height)
        //set vertices to match the rectangle that was pass here

    Update(float deltaTime)
            curTime += deltaTime;
            if(curTime >= endTime)
                finished = true;
                curTime = endTime;
            color.alpha = curTime / endTime;


         DrawQuad(vertices, color);

Thats it. And in your scene update, do this:

SplashScreen::Update(float deltatime)
        ChangeScene(MainMenu); //Or something like

Hope it helps you to think in a way to do this.

share|improve this answer
Thanks,For helping me it helped me lot i used the CountDownTimer now it is working for me as a splash screen.Thank you soo much for helping me. – jubin Jan 13 '12 at 11:46
glad to see it helped you. If so, please do me a favour? "When you have decided which answer is the most helpful to you, mark it as the accepted answer by clicking on the check box outline to the left of the answer" – Gustavo Maciel Jan 13 '12 at 22:12

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.