Search code examples
cocos2d-iphonecocos2d-x

body node in Cocos2dx


Can you please convert this cocos2d code to cocos2dx?

shiprightnode = [[Shipright alloc] initWithBody:shipright game:game_];
[game_ addBodyNode:shiprightnode z:1];
[shiprightnode release];

Solution

  • shiprightnode = new Shipright();
    shiprightnode->init(p_game_);
    game_->addBodyNode(shiprightnode);
    shiprightnode->release();