Tutorial 7 : Some Icing on the Cake getSharedDirector() should be sharedDirector()


#1

Impressive how quickly you responded to my first post. Here’s one more:

In tutorial 7

Lines 7 and 4 need to be updated from CCDirector::getSharedDirector() to CCDirector::sharedDirector()

1 // cpp with cocos2d-x
2 _projectilesDestroyed++;
3 if (_projectilesDestroyed > 30)
4 {
5 GameOverScene *gameOverScene = GameOverScene::node();
6 gameOverScene->getLayer()->getLabel()->setString(“You Win!”);
7 CCDirector::getSharedDirector()~~>replaceScene;
8 }

1 // cpp with cocos2d-x
2 GameOverScene *gameOverScene = GameOverScene::node;
3 gameOverScene~~>getLayer()->getLabel()->setString(“You Lose :[”);
4 CCDirector::getSharedDirector()->replaceScene(gameOverScene);


#2

Thank you for pointing out our mistakes, I have updated them.


#3

hi!
many many thanks for this tutorial
also for the port tips, they were very useful
The final game sample from github didn’t work for me, (in Xcode: lots of errors even after copying the missing folders, dunno why)
but it was good for me because I did a copy from the HelloWorld project and started from there (on Windows :p)


#4

Thanks for your feedback!
I think RongHong has tested it before publish. We would trace it again today.


#5

Hello, Laurens, I don’t quite catch you.
Do you mean that you get the simple game code from here: https://github.com/cocos2d/cocos2d-x-samples/tree/master/Cocos2dxSimpleGame, and there are many compiling errors?

There is an instruction here: https://github.com/cocos2d/cocos2d-x-samples/blob/master/Cocos2dxSimpleGame/README.mdown
Could you do it again following the instruction and give us a feedback?


#6

Well, post a part of your error logs will be helpful.


#7

Hello RongHong
my bad, I missed that readme, I suggest making it the default readme at the repo
right now the readme is a 0 bytes file.
After reading that file and trying in Xcode 3.2.5 it works like a charm.
In Visual2008 however the game project needs to have added as dependencies the library projects for compiling them first
because it’s failing to link the the first time.

Sorry about the false report.
Thanks


#8

@Laurens Rodriguez
I placed README.mdown in the root of Cocos2dxSimpleGame, http://github.com/cocos2d/cocos2d-x-samples/tree/master/Cocos2dxSimpleGame
The readme in its parent folder is 0 bytes, because this repo is not only for Cocos2dxSimpleGame, but also for more samples in future. Yep, we plan to write more open source sample code for cocos2d-x :slight_smile: