Idea: loopable instance variables with indexes

0 favourites
  • 3 posts
From the Asset Store
Easily store, modify, read and manipulate colors with Color Variables!
  • Is it something that could be added in a near future? It would be great because it'd allows us to keep more of the data assigned to the respective object and make families and (now)custom actions even more useful. It would also make code much more readable.

    The idea behind this is that, for something that requests a large amount of variables, I usually use arrays and, to get this to work properly without getting lost of which cell is what, I need variables to hold these coordinates and this is fine. However, simple operations involving these variables makes it too troublesome and polluted by too much calls. I always use functions to get rid of most of it and return the value I need but still, it's nothing compared to the simple way of calling an instance variable, it's short and readable.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • This sounds interesting, are you basically thinking of an array as an instance variable? If I’m understanding correctly this could be a useful feature!

    Instead, you could look into using a dictionary instance per object and/or one or more arrays. Or a comma separated instance string variable and then use tokenat/count to loop through where necessary.

  • This sounds interesting, are you basically thinking of an array as an instance variable? If I’m understanding correctly this could be a useful feature!

    Instead, you could look into using a dictionary instance per object and/or one or more arrays. Or a comma separated instance string variable and then use tokenat/count to loop through where necessary.

    Not an array, just a way of running a loop through instance variables.

    About your idea of dictionaries and arrays, this is exactly what I explained in the first post ^^

    If instance variables had an index would be great as we could put the heavy stuff in an appropriate data structure like an array or dictionary and then loop through all it's data and replicate it's final values into instance variables. In a situation where the array holds the initial value and several modifiers, we would hold the final value in the instance variable, making it much easier to access it and more readable

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