ambiera logo

Ambiera Forum

Discussions, Help and Support.

folder icon Ambiera Forum > CopperCube > Programming and Scripting
forum topic indicator js class
person icon
Guest
Guest
Quote
2023-05-11 02:20:40

as i can see cc can't use class structure by execute js, or is there some special way to create class in cc?
for example i write:

class MyClass{
constructor(nodeName, mass){
this.node = ccbGetSceneNodeFromeName(nodeName);
this.nodeMass = mass;
}
}

and can't use it, even more i always get "SyntaxError: missing ; before statement"...

person icon
Guest
Guest
Quote
2023-05-11 02:59:42



var MyClass = function(name, mass)
{
this.name = name;
this.mass = mass;
}

MyClass.prototype.getNode = function()
{
return ccbGetSceneNodeFromName(this.name);
}

var bob = new MyClass("bob", 2000);

print(bob.name);
print(bob.mass);

ccbSetSceneNodeProperty(bob.getNode(), "Visible", false);



Create reply:










 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


icon_holyicon_cryicon_devilicon_lookicon_grinicon_kissicon_monkeyicon_hmpf
icon_sadicon_happyicon_smileicon_uhicon_blink   






Copyright© Ambiera e.U. all rights reserved.
Contact | Imprint | Products | Privacy Policy | Terms and Conditions |