Thanks for your encouragement and support, and I have been given a lot of motivation. Today, I finally met you in the advanced article.
Update: A box2d physical Engine video was produced.Http://blog.csdn.net/s_xing/article/details/20836727
If you are not familiar with the basic concepts of cocos2dx, please refer
Http://blog.csdn.net/s_xing/article/details/18557631.
Reprinted please indicate the source http://blog.csdn.net/s_xing/article/details/20165097
HD avi video download:
Baidu online storage:Http://pan.baidu.com/s/1ELk78 .
Today, I attended a total of five lessons, learning a game from a foreigner. Original article address: http://www.raywenderlich.com/1163/how-to-make-a-tile-based-game-with-cocos2d. The knowledge points are trivial.
1. Use of tiled map editor
Http://www.mapeditor.org/
2. tiled map can contain two layers
(1) map layer, obtained through the CCTMXLayer * backLayer = tileMap-> layerNamed ("flag_layer") Method
(2) Objects layer: Use CCTMXObjectGroup * og = tileMap-> objectGroupNamed ("spritePositions"); then you can obtain an object and related attributes.
3. Definition of the anchor and functions of the anchor
4. CCSprite can be added to CCLayer or CCSprite. In short, the objects in cocos2dx are level-1 objects, and the final result is like a DOM tree. The setPosition of each object is relative to its parent node. The parent node moves the child node. We can use the convertToNodeSpace method to convert the coordinates relative to the screen (accurately called the world coordinates) into the coordinates relative to the node.
5. How to move the main character to the center of the screen, and ensure that the map always covers all the screens.
6. How to handle touch events.
This-> setTouchEnabled (true); // The layer has the ability to respond to touch events.
CCDirector: sharedDirector ()-> getTouchDispatcher ()
-> AddTargetedDelegate (this, 0, true );
Rewrite three methods:
Bool HelloWorld: ccTouchBegan (cocos2d: CCTouch * pTouch, cocos2d: CCEvent * pEvent)
Void HelloWorld: ccTouchMoved (cocos2d: CCTouch * pTouch, cocos2d: CCEvent * pEvent)
Void HelloWorld: ccTouchEnded (cocos2d: CCTouch * pTouch, cocos2d: CCEvent * pEvent)
Tip1: We recommend that you use PotPlayer (pc) and vplayer (android) to accelerate playback. 1.3 times faster, saving everyone time.
Tip2: I suggest you pause thinking or repeat it several times.
Reprinted please indicate the source http://blog.csdn.net/s_xing/article/details/20165097