instance variables groups resusable

Discussion and feedback on Construct 2

Post » Mon Jun 15, 2015 2:36 am

group variables! I often organize an objects variables by creating multiple objects and putting them in a container, but this gets messy with families. Having a hundred variables on an object is also messy. It would be much better to be able to create a predefined group of variables that can then be added whole sale to an object. Much like a structure.

Example: tired of always adding ceartain variables to objects...

Instance variable group "Velocities" = {

x as number
y as number
lastx as number
lasty as number


Once defined, this group could be added to any object in any project. It could be accesses in expressions via someobject.Velocities.lastx.

Also, one could create functions and attach them to objects in the same way. the contents of the function would be an event sheet where the object reference self would always point to the object calling the function

And instance function "SaveLastPosition" = {
self.velocities.lasty = self.velocities.y

Posts: 563
Reputation: 5,141

Post » Mon Jun 15, 2015 5:59 am

Simply said, you want to be able to add instance dictionary?
You can save a json string in a instance string.

Or you mean real class objects?
like "new RGB()"
Yes, I think you want this, how do you think this should work?
Thats like writing a Behavior.


Edit: You describe a Behavior.
Last edited by deathangel1479 on Mon Jun 15, 2015 6:31 am, edited 5 times in total.
Sorry for my bad english, but I really do my best! And use and check with Google Translator.
Posts: 158
Reputation: 1,303

Post » Mon Jun 15, 2015 6:20 am

As a workaround you can add a Dictionary object to the container and use it to store variables for that "group" of objects.... but you will need quite few pointless events to make that work.

and yeah, working with multiple objects (especially with different types of objects) is quite bad in C2.... Lovely Huds and UIs made of many different kind of objects needs not so lovely but idiotic funny and long list of events that you can lost yourself in. :)

Edit: and not being able to call objects by their name makes everything even more "not cool".
Posts: 2,590
Reputation: 34,640

Post » Mon Jun 15, 2015 10:43 am

simply said , we need containers that are far more powerfull then what we have now, it just doesn't cut it for complex object structure, what is needed if you want to have great UI, fitting shapes, text and icons, multiple states

you can call it container, group or structure, or should i dare call it a movieclip ??

working with the different object types becomes way to complex
pinning each object or making your own structure for following objects > complexity
9 scale that is want to use, is not usefull as it has no frames, so you need a new object for each style = extra complexity

@ashley i wonder if you have some sort of plan of implementing a new way of "structuring" objects or do you think this is not needed ?
Posts: 827
Reputation: 10,017

Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 6 guests