Array Optimization?

  • If I'm going to use a bunch of arrays is it better to add one object to the project and differentiate with instance variables? Or will it really not make much of a difference if I add the plugin/object several times?

  • well you add an Array object for each array you actually need. It's not like the Audio object since you define the array and fill it with data. If you are only using one array at a time I suppose you could redefine the array and reset it for use - as long as you don't need to overlap usages.

  • jobel

    I believe badmoodtaylor was asking about using multiple array instances vs multiple array objects.

    I don't think there are any differences in terms of performance. Use whatever method is easier and more convenient.

    If different arrays have different purposes - use multiple array objects.

    If you want to attach an array to every instance of some other object (for example Enemy sprite + EnemyStats array), you can add them both to a container. This way each EnemyStats instance will be created automatically and will be linked with its Enemy instance.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Yes dop2000 that is what I was getting at.

    I know it probably won't make much of a difference in small quantities. I just keep finding reasons to add arrays though so thought I'd look into it as converting down the line sounds like a major headache.

    Make sense to use instances if they are somehow related. Things like clearing the related arrays would be easy that way.

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