Requesting assistance

Requesting assistance
0.0 0


Hey guys, I’ve been trying to learn how to make a simple game with an online tutorial, however it seems like it’s pretty outdated now, and uses deprecated methods :frowning:

I did some searching and found another tutorial by a person name Paralaxer:

I’d really appreciate some help before I invest more time into this endeavor!
Here are a few of my concerns:

How do you search for the new and updated code to use in place of a deprecated one? There doesn’t seem to be a universal way to do this.
Is reading Paralaxer’s website the best way to go for learning Cocos2d-x?
Any tips that you guys think that I might find helpful on this journey?

Appreciate all the responses I get!

  1. Paralaxer is a project, not a person.
  2. Yes, paralaxer is a nice place to start Cocos2d-x (although it hurriedly jumped into box2d). It’s one of the best updated ones so far.
  3. What do you mean “search for new and updated code to use”? Did you mean samples and tutorials? The best way to learn cocos2d-x is to actually play around with it. That’s the way I learned. You could also look up stuff in the API Reference
  4. As for the tips, try using the latest of cocos2d-x first. Then play around with it, especially on the multi-resolution part. It’s one of the hardest thing to master, especially if you are working on devices with different aspect ratios.



Alright, I tried playing around with some code, however some of the errors utterly confused me and google wasn’t much help =s

Here’s an example:

_batchNode = CCSpriteBatchNode::batchNodeWithFile("Sprites.pvr.ccz");

_ship = CCSprite::spriteWithSpriteFrameName("SpaceFlier_sm_1.png");
CCSize winSize = CCDirector::sharedDirector()->getWinSize();
_ship->setPosition(ccp(winSize.width * 0.1, winSize.height * 0.5));
_batchNode->addChild(_ship, 1);
return true;

From what I can tell, CCSpriteBatchNode::batchNodeWithFile no longer exists in the lastest version, it’s not even shown as deprecated like many other deprecated methods, so I tried the next most logical method:

_batchNode = CCSpriteBatchNode::initWithFile("Sprites.pvr.ccz");

And got an error:

Call to non-static member function without an object argument

So I’m guessing my approach is wrong :frowning:

I’ve read through the basic concepts here:

And I’m trying to find a working example that illustrates those concepts right now, I heard that there were some samples that came along with the cocos2d-x installation but I couldn’t find any other than the helloworld.ccp, any guidance is much appreciated!

Scanning the wiki for knowledge in the meantime!


Found out how to create a sprite with a batchnode from the patch notes in the wiki:

// create batch node from image file
@ *batchNode = CCSpriteBatchNode::create;@
@ // get the texture in batch node@
@ CCTexture2D* texture =*batchNode~~>getTexture;@
@ // create sprite from this texture@
@ CCSprite* sprite = CCSprite::createWithTexture);@
@ // organize the child relation@
@ this~~>addChild(*batchNode);@
@ CCSpriteFrameCache::sharedSpriteFrameCache()>addSpriteFramesWithFile;@
@ *ship = CCSprite::createWithSpriteFrameName;@
@ CCSize winSize = CCDirector::sharedDirector
@ _ship~~>setPosition);@
@*batchNode~~>addChild(_ship, 1);@
@ return true;@


@Nothing Sort,

You should choose a better title for this thema.
“Requesting assistance” is not really helpful.


@P. E.

Oh sorry, I had several questions at the time of posting and it felt rather general, couldn’t come up with an exact topic name :smiley:

Right now I’m just trying to grasp the fundamentals by trying out online tutorials, a lot of the turtles use now-deprecated classes, and I’m just trying to figure out their new names, there doesn’t seem to be any universal or easy way to do this, or maybe I’ve not figured it out yet, can anyone provide some pointers?:slight_smile:


Hi Nothing Sort

The first thing you should do (especially as a C++ programmer) if you aren’t sure if functions exist or not or what functions to use is to check the related Header file. For deprecated functions, cocos2d-x specifically comment that functions are deprecated or soon-to-be in the header files. By reading the header files you will also find the new standard, usually it is explicitly stated as the replacement for the deprecated function; however, in the case of CCSpriteBatchNode it states:

/** creates a CCSpriteBatchNode with a file image (.png, .jpeg, .pvr, etc) and capacity of children.
The capacity will be increased in 33% in runtime if it run out of space.
The file will be loaded using the TextureMgr.
@deprecated: This interface will be deprecated sooner or later.
CC_DEPRECATED_ATTRIBUTE static CCSpriteBatchNode* batchNodeWithFile(const char* fileImage, unsigned int capacity = kDefaultSpriteBatchCapacity);

/** creates a CCSpriteBatchNode with a file image (.png, .jpeg, .pvr, etc) and capacity of children.
The capacity will be increased in 33% in runtime if it run out of space.
The file will be loaded using the TextureMgr.
static CCSpriteBatchNode* create(const char* fileImage, unsigned int capacity);
static CCSpriteBatchNode* create(const char* fileImage) {
return CCSpriteBatchNode::create(fileImage, kDefaultSpriteBatchCapacity);

You will want to be reading over header files for similar functions too if you are reading over tutorials as most of them are out-dated and have alternate or deprecated methods.

Personally, I haven’t found a tutorial that is up-to-date enough to be really of much value to bettering my ability with cocos2d-x and have learnt most of what I know so far through searching the forums, google and methods in tutorials as well as trial and error while attempting my own projects.


Nothing Sort: i’m trying the same tutorial. could you port the rest of the code ?


Sorry for the late response, thanks for the tip Tim H, it helped a whole lot!

@franck -
I’m still in the middle of solving it when I have time, I’ve encountered a few incompatibilities that I think I can solve, once it’s done I don’t mind sharing my solutions!:slight_smile:


Alright, I seem to have hit a brick wall, can anyone help on this problem?