"COCOS2D-JS Official Documents" IV. basic data types

Source: Internet
Author: User

The underlying data types are created uniformly through methods. New mode is no longer supported

1, coordinate cc. Point altogether 3 ways to create

Structure: {x:0,y:0}

//1 快捷创建,返回相当于cc.p(0,0)var point1 = cc.p();//2 常用var point2 = cc.p(100,100);//3 拷贝var point3 = cc.p(point2);
2, Size cc. Size altogether 3 ways to create

Structure: {width:0,height:0}

//1 快捷创建,返回相当于cc.size(0,0)var size1 = cc.size();//2 常用var size2 = cc.size(100,100);//3 拷贝var size3 = cc.size(size2);
3, regional CC. Rect altogether 3 ways to create

Structure: {x:0,y:0,width:0,height:0}

//1 快捷创建,返回相当于cc.rect(0,0,0,0)var rect1 = cc.rect();//2 常用var rect2 = cc.rect(100,100,100,100);//3 拷贝var rect3 = cc.rect(rect2);
4, Color cc. Color altogether 5 ways to create

Structure: {r:0,g:0,b:0,a:0}

//1 Quick Create, return equivalent to Cc.color (0,0,0,255); var color1 = Cc.color ();//2 Common, does not contain alpha value var Color2 = Cc.color (255,255,255);//3 commonly used, containing the alpha value var Color3 = Cc.color (255,255,255,255);//4 copy var color4 = Cc.color (color2);//5 Fixed color var color5 = cc.color.white; Common 9 fixed color types cc.color.white;//white cc.color.yellow;//yellow cc.color.blue;//Blue Cc.color.GREEN ;//green cc.color.red;//red cc.color.magenta;//magenta cc.color.black;//black cc.color.orange;//orange cc.color.gray;//gray  
Reprint Please specify: http://www.douapp.com/post/2436

"COCOS2D-JS Official Documents" IV. basic data types

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.