Cocos Creator self-learning experience------first day of scripting

Source: Internet
Author: User

Read the document directly from the beginning using CC. class declaration type declaration of the class object that block forgot, and familiar with JS about the object description, (details visible http://www.w3school.com.cn/js/js_objects.asp) Then, about the constructor (HTTP/ www.cnblogs.com/iceknp/archive/2010/06/08/1753729.html), Get () set () (This is a typical understanding of the object-oriented opening and closing principle https://zhidao.baidu.com/ question/494920588281615924.html), a Java or C # base should be pro.

There are two main points that may be used in the future to inherit one or the other:

var Shape = cc.    Class ({ctor:function () {Cc.log ("Shape"); When instantiated, the parent constructor is automatically called,}}); var Rect = cc. Class ({extends:shape}); var Square = cc.   Class ({extends:rect, ctor:function () {Cc.log ("Square"); Call the sub-constructor}}); var square = new Square ();

        Second, to declare attributes, only the CC is required. Class-defined   properties   field, fill in the property name and attribute parameters, such as:

Cc. Class ({extends:cc.Component, properties: {userid:20, UserName: "Foobar"}});


Noon did not sleep, the afternoon suffers, today will come here,



This article is from the "12249049" blog, please be sure to keep this source http://12259049.blog.51cto.com/12249049/1870307

Cocos Creator self-learning experience------first day of scripting

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.