Hi there! I’m new to cocos2d-x. I’m testing a simple HelloWorld project on both AVD and real device and everything works well, but if I change something in the HelloWorld::init() method to customize the project, when I launch the application, it shows always the default helloworld’s assets instead of my changes in the code and my assets.
Yes, but I just changed the init() method in the HelloWorldScene.ccp.
Here is the code:
#include "HelloWorldScene.h"
#include "SimpleAudioEngine.h"
using namespace cocos2d;
using namespace CocosDenshion;
CCScene* HelloWorld::scene()
{
// 'scene' is an autorelease object
CCScene *scene = CCScene::create();
// 'layer' is an autorelease object
HelloWorld *layer = HelloWorld::create();
// add layer as a child to scene
scene->addChild(layer);
// return the scene
return scene;
}
// on "init" you need to initialize your instance
bool HelloWorld::init()
{
//////////////////////////////
// 1. super init first
if ( !CCLayer::init() )
{
return false;
}
// ask director the window size
CCSize size = CCDirector::sharedDirector()->getWinSize();
CCSprite *bg = CCSprite::create("moles_bg.png");
bg->setPosition(ccp(size.width/2, size.height/2));
this->addChild(bg, -1);
return true;
}
void HelloWorld::menuCloseCallback(CCObject* pSender)
{
CCDirector::sharedDirector()->end();
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
exit(0);
#endif
}
I think that, maybe, the problem is not in the code but somewhere in the project settings. I have created and setted the project step by step following different online guides.
Is there anyone who got the same problem?
Yes I can but if you want to speak in audio/video, it is not I good idea, cause my conversation skills are not so good. Also I think that this problem should be resolved publicly. So if you want help me just writing, it’s Ok! skype: sanweb82
I told you some hints/improvements.
Have you tried it?
Another good startpoint to beginning programming with cocos2dx is: http://www.cocos2d-x.org/wiki/Developers_Manual .
And last but not least: Developing on Windows/Mac OSX is easier with cocos2dx
If your game is ok so you can compile it for android of course too.
Hi, I have downloaded cocos2d-x3.0alpha0 but I’m having trouble. Simply debugging the base project in Eclipse I’m getting this error: Fatal signal 11 (SIGSEGV) at 0x00003033 (code=1) ….