instance variables groups resusable

  • 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

    }

  • Simply said, you want to be able to add instance dictionary?

    You can save a json string in a instance string.

    Edit:

    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.

  • 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".

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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 ?

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)