I am a new user of cocos2d. now I am develop card game. but suffer difficulty: when send card, it’s back of the card, and when open card, we should make effect from card back to front.
can you give me some suggests?
CCPointer is an extension for cocos2d-x that you can download from here
Is a smart pointer to be used with cocos2d-x objects. In case you do not want to use it, you can change the following lines:
// Our main menu object
CCPointer <CCMenu> _MainMenu;
// Each component of our menu (we will reuse them)
CCPointer <CCMenuitemsprite> _mainMenuButtons;
by this:
// Our main menu object
CCMenu *_MainMenu;
// Each component of our menu (we will reuse them)
CCMenuItemSprite *_mainMenuButtons;
As you can see, you can just use normal pointers and your problem will go away 🙂
About your other question and the missing function, as i just mention in a another comment above I think the one I have used on this post was from an older version, and is deprecated now:
I think that the method spriteWithSpriteFrameName has been deprecated and now you have to use createWithSpriteFrameName
Thanks for your fast response, If i use the pointer like you say, it works, but it crashes in other lines…
I think cocos2dx has changed a lot to make your code works in the actual version…
July 7th, 2013 on 6:14 am
I am a new user of cocos2d. now I am develop card game. but suffer difficulty: when send card, it’s back of the card, and when open card, we should make effect from card back to front.
can you give me some suggests?
Thanks a lot!
July 8th, 2013 on 10:40 am
Hi Lena,
If I understand correctly you want to create an effect kind of “fade in” / “fade out”. Let me suggest you some links:
1- This is an implementation of fade in / fade out effect with some blinking:
http://gamedev.stackexchange.com/questions/31235/image-with-fadein-effect-blinks-when-added-to-scene
2- Some tips about how to flip a card around a corner (Perhaps the same effect you are trying to do):
http://gamedev.stackexchange.com/questions/53622/how-to-flip-card-by-a-corner
3- The last one is an advance effect. If you know your way around shaders, perhaps you can try this:
http://www.raywenderlich.com/10862/how-to-create-cool-effects-with-custom-shaders-in-opengl-es-2-0-and-cocos2d-2-x
I hope this helps, if you have any further question, please let me know 🙂
July 16th, 2013 on 4:02 pm
thanks!
July 21st, 2013 on 5:23 pm
Thanks for posting this tutorial. I am curious which version of Cocos2d-X you are running and if you are on VS10 or VS12?
July 22nd, 2013 on 11:17 am
Hi, thanks for you comment 🙂
For this post I used VS 2010 and cocos2d-x-2.0.3
I think that the method spriteWithSpriteFrameName has been deprecated and now you have to use createWithSpriteFrameName
I might update the tutorial in order to make it compatible with cocos2d-x-2.1.4
April 6th, 2014 on 6:56 am
thanks
April 6th, 2014 on 10:16 am
You are welcome 🙂
May 8th, 2014 on 12:18 am
Hi, thanks for the tutorial,
Can you tell me what happened with CCPointer?
I can’t find also the equivalent of “itemWithNormalSprite”
Thanks again, Rod.
May 8th, 2014 on 2:30 pm
Hi Rod,
CCPointer is an extension for cocos2d-x that you can download from here
Is a smart pointer to be used with cocos2d-x objects. In case you do not want to use it, you can change the following lines:
by this:
As you can see, you can just use normal pointers and your problem will go away 🙂
About your other question and the missing function, as i just mention in a another comment above I think the one I have used on this post was from an older version, and is deprecated now:
I hope this answers your question,
aeonphyxius
May 9th, 2014 on 2:57 am
Thanks for your fast response, If i use the pointer like you say, it works, but it crashes in other lines…
I think cocos2dx has changed a lot to make your code works in the actual version…
Thanks a lot 🙂
May 9th, 2014 on 11:53 am
Hi Rod,
I had updated this tutorial to work with cocos2d-x 2.2.3 what is the last 2.x version. The source files also has been updated accordingly.
As you can see below there are some small changes in the creation process :
I can’t say if this code works with 3.x as the game I am working on is going to be released in the next days and will be released with cocos2d-x 2.2.3
Also, if you do not manage, just drop me an email with your code and we can have a look together.
May 10th, 2014 on 12:22 am
Now it works pretty nice!
Thank you so much aeonphyxius!!
What kind of game are you developping? 🙂
Could you please tell me, if I want to call a .tmx file, for example by clicking the play button, how should I do to manage the different scenes?
Something like CCDirector::sharedDirector()->end();
Thanks again for sharing your knowledges!
May 10th, 2014 on 1:43 am
I used:
CCScene *hScene = HelloWorld::scene();
CCDirector::sharedDirector()->replaceScene(hScene);
to change scene and it works perfect!