Not able to change the background of the scene in cocos2dx android

| | August 10, 2015

I have started Game Development using Cocos2d-x. And started with HelloWorld sample game. I am able to run this sample game. But when I try to change the Background Color, I am getting error in

 HelloWorldScene.h
    The type 'HelloWorld' must implement the inherited pure virtual method 'cocos2d::CCRGBAProtocol::setOpacity' 

Changes:
class HelloWorld : public cocos2d::CCLayerColor

and also in

 **HelloWorldScene.cpp**

    Invalid arguments '
    Candidates are:
    bool initWithColor(const cocos2d::_ccColor4B &, ?, ?)
    bool initWithColor(const cocos2d::_ccColor4B &)
    '
   **Changes:**
   CC_BREAK_IF(!CCLayerColor::initWithColor(ccc4(255,255,255,255)));

I am new for Cocos2d-x and also for C++. Is there any thing left to include or what?

One Response to “Not able to change the background of the scene in cocos2dx android”

  1. in my case my problem was solved after writing this for background color change to white
    glClearColor(1.0,1.0,1.0,1.0);

Leave a Reply