User defined objects and attributes in Cocos Studio

Hi,

I’ve been using Cocos Studio and it’s pretty cool for general animation and GUI work, but some simple limitations prevent it from being used for something even more useful like a level editor.

Let’s imagine I want to design my levels using Cocos Studio. I want to define the player position/scale/etc but also the enemies position/scale/etc.

The enemies themselves can have several attributes, like strength, speed, etc.

As it currently stands, the closest thing I can get in Cocos Studio to represent my Player is the Sprite Element. I can tell if a given sprite is the player by checking it’s name or tag. I can do the same things for the enemies.

But how can I set custom attributes like speed and strength? The inability to do so means that I need to design the graphical representation of the level using Cocos Studio and keep a config file with all the properties for each element in the scene. This is tedious and error-prone.

What if you could create “custom” objects in Cocos studio with custom attributes? I could create a “Enemy” class that would extend from Sprite, and I could say that it had attributes x,y,z with primitive types. This wouldn’t need to be anything complicated.

By having these extensibility, I could represent my entire level using Cocos Studio, I could tell at the glance everything about the elements of my level, and the integration with the logic would be easier.

What do you guys think?

EDIT

Ok, so according to the docs there should be something called Data Cruncher and Scene Editor with custom properties but I can’t find any of those tools with the most recent installation of Cocos framework. (I’m on a Mac).

1 Like

I too am interested in adding custom properties to objects in Cocos Studio and pulling those values during runtime in my game.

I scoured online and there is not much documentation about how to do that. There is the CCNodeLoader (NodeLoader) which has the custom properties field (_customProperties) which is a Dictionary. Is that how we add custom data to Cocos Studio that we can read during the game.

For example, I add a basic Node to my Scene in Cocos Studio. I want to add a couple of custom properties to this Node. For example, I want to select a random color of three and I put those three color options there. How do I read those values in game after.

thanks

I think this will be added soon enough. Right now you could give a Node a ClassName, write a own classNameReaderer and register this Readerer with the CSLoader. Than the CSLoader will load the node as your own created class. On this class you can add properties like speed ect. But yeah, that’s still on the c++ side.