[Extension] Create Own Component?

Hello,

I need to create my own Properties for Nodes in Cocos Creator. I found a Document Inspector Extension which might descripe a way to create own Components. Maybe someone could translate or just explain me (in short) if this Document is describing the creation of custom components. I need a Way to pass custom Properties to a Node.

Another idea: I would create an object with your properties and a link to the node.

Hi Mike, that sounds good for me. I mean thats just what I need. But I don’t see an option to create my own properties. could you please explain it a little bit detailed?

Hi Murat,

here an idea for an object where you can set a link to your node:

var GameObject = function ( node )
{
  this.color = 'green';
  this.size = 200;
  this.time = 0;
  this.node = node || null;
}

GameObject.prototype = {
  constructor: GameObject,
  update: function( dt )
  {
    time += dt;
    if ( this.node !== null && time > 10 )
      this.node.active = false;
  }
};

Cheers

Mike

Ok, now I see how you meant it. You create your custom properties dynamicly in your Game Code. Am I right?

I need a way to create properties in the Cocos Creator Editor. like…

Currently I am developing a Editor Extension to use with Cocos2dx [C++] I need a few custom Properties.

Yes, and sorry I don’t know yet how to create extensions. But wasn’t here a discussion about it latly?

I searched a lot but the Informations about extending cocos creator are rare. I lately asked a CC Developer if and how I can create custom nodes for CCEditor dynamicly (not possible). A few days later I found that chinese documentation abouts Components and Properties (see link above). I think, that this could be the solution… but I don’t understand any word and google translate is :unamused:

But thank you for answering to my question i appreciate it.

Hi @MuratAlbayrak,

download the source code of Cocos Creator Engine from the link below, maybe it contains something important:

Browsing the sources helped me so many times.

Best regards,
Zsolt

Hi @MuratAlbayrak @MikeFromMars @PZsolt27

How to create extensions:

http://cocos2d-x.org/docs/editors_and_tools/creator-chapters/extension/index.html

God Bless…

Sincerely,

Sunday

Hi,

thanks for your reply. The link in my first posting is from this documentation that you have linked. at least 40% of this Documentation is in chinese language or with empty Content. Thatswhy I asked the Community to help me. :-/

@PZsolt27 I just modified a standard CC Component. The Editor is recognizing my changes. Your hint gets me a little closer to a solution. A seperated Extension would be a better solution than changing the CC Code but as long as the Documentation is not translated/finished I have to do it that way. at least for now. Thanks so far!

Hi @MuratAlbayrak,

you’re welcome! :slight_smile:

Best regards,
Zsolt