Cocos Creator API

0.7.1

Cocos Creator is a highly customizable game development tool that utilizes the power of cocos2d-x.

Class

Module: cc

Defines a CCClass using the given specification, please see Class for details.

examples:

// define base class
var Node = cc.Class();

// define sub class
var Sprite = cc.Class({
name: 'Sprite',
extends: Node,
ctor: function () {
this.url = "";
this.id = 0;
},

properties {
width: {
default: 128,
type: 'Integer',
tooltip: 'The width of sprite'
},
height: 128,
size: {
get: function () {
return cc.v2(this.width, this.height);
}
}
},

load: function () {
// load this.url
};
});

// instantiate

var obj = new Sprite();
obj.url = 'sprite.png';
obj.load();

// define static member

Sprite.count = 0;
Sprite.getBounds = function (spriteList) {
// ...
};

Methods

_isCCClass
(
  • constructor
)
Boolean private

Checks whether the constructor is created by cc.Class

name type description
constructor Function

returns:

type: Boolean

There are no methods that match your current filter settings. You can change your filter settings in the index section on this page. index