Coco2dx game development simple getting started video tutorial advanced article-1st days-eat watermelon games.

Source: Internet
Author: User

Thanks for your encouragement and support, and I have been given a lot of motivation. Today, I finally met you in the advanced article.

If you are not familiar with the basic concepts of cocos2dx, please visit 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 is still in the old place Baidu Network Disk: http://pan.baidu.com/s/1ELk78 inside the advanced article.

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.