[IOS-Cocos2d (2.x) game development in one] custom ccsprite-(ID) Init rewrite need to note & 2. X version registered touch screen event code & brief cocos2d/X/unity3d engine make

Source: Internet
Author: User

All articles on this site areLi huaming himiOriginal, reprinted must be explicitly noted:
Reprinted from[Heimi gamedev block]Link: http://www.himigame.com/iphone-cocos2d-v2/736.html

☞Click to subscribe☜
The latest developments in this blog! Notify you of the latest blog in time!

Let's talk about technical issues first;

Himi has a period of time without tossing the Cocos2d-iphone, a few days ago to download the latest cocos2d 2.x version try to use, found two common knowledge points need to pay attention to the place, here to share;

1. For cocos2d 2. x, When you (custom genie) customize a class and inherit the sprite ccsprite, be sure to pay attention! Pay attention to the following constructor:

-(id) init{        return self;}

In cocos2d 2.x, Initialization is not performed by default, that is, the parent class does not automatically call the init function of the subclass. Therefore, pay attention to it here;

2. For cocos2d 2.x, the registration mechanism for touch screen time has changed. The following Code shows that:

Cocos2d 2.x touch screen time registration code:

[[[CCDirector sharedDirector]touchDispatcher] addTargetedDelegate:self priority:0 swallowsTouches:NO];

Cocos2d 1.x touch screen time registration code:

[[CCTouchDispatcher sharedDispatcher] addTargetedDelegate:self priority:0 swallowsTouches:YES];

OK. Here is the knowledge point reminder for this chapter. For more differences that need to be paid attention to, himi will write a blog post to remind you in time;

-------

Let me briefly talk about the cocos2d-iphone, cocos2dx, unity3d use feelings, in fact, for the three engines himi have been used for development, although relative to unity3d use less, but also has started, I have also written a lot of demos (not even if I update my blog for some time). When I use these engines, himi thinks these three engines are good engines for iOS development, cocos2dx and unity3d are more suitable for cross-platform development than cocos2d, and have matured on both Android and iOS platforms.

So if I only want to develop iOS platform should use cocos2d-iphone? Cocos2dx?

Here himi can certainly tell you that the two engines can be, the two are only different focus, for the cocos2d-iphone engine, it is more convenient, specific and stable; the relationship between the two is like a programmer who can develop both the client and the server with three years of game experience, and a programmer who has been dedicated to the client for three years;

Cocos2dx is more suitable for you if other platforms may be used later, and cross-platform development is now a trend;

So if I want to use cocos2dx for cross-platform development? Unity3d?

The choice of these two engines is mainly from two aspects:

1. Funds;

If you are not short of money, you can directly choose unity3d. After all, cocos2dx is free and open-source. If you are short of money, you will be unable to accept the unity3d usage fees, certificate fees, and plug-in fees;

2. Development route;

If you prefer to develop 2D games, we recommend that you use cocos2dx for cross-platform development, because cocos2dx is an engine tailored to 2D games. It is faster to use than untiy3d for fast development;

If you prefer 3D or 2D game development, we recommend that you use unity3d because unity3d is more convenient and professional for 3D game production; of course, cocos2dx is not ready to develop on the 3D route in the last two years;

Here, himi has two additional points:

1. Some kids shoes asked himi why I abandoned Android and started to do IOS?

I am very surprised to ask this question. For himi, Android IOS is a platform. As long as it is a mobile phone platform and himi is worth learning, himi will study and study it, because I prefer to use new technologies, this is a pursuit of myself, and now himi is both in Android and IOS. So there is no such thing as abandoning android!

2. When I saw my himi writing unity3d blog, I asked if I finally found that android cross-platform unity3d was the king?

In fact, himi never thought that way. I am eager to say that the unity3d engine himi has always been somewhat excluded from it, because many of my himi friends have done unity3d for 1 or 2 years, after communication, unity3d is regarded as a planning tool. For programmers, the code will become increasingly unfamiliar. This shows that unity3d is a relatively complete and powerful development engine, and visualization has been quite powerful. However, on the other hand, it can be seen that unity3d has processed all the major departments at the code layer visually, this allows many non-program developers to quickly master and develop;

As a matter of fact, I want to talk about the self-view of unity3d. In fact, himi just wants to say that all engines familiar to everyone have advantages and disadvantages. I cannot assert that XXX is a very good and perfect engine, the engine that suits the company is actually a perfect engine;

Therefore, the engine selection is not only related to the platform, but more himi think it is related to the user;

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.