Beginner question about instances

0 favourites
  • 2 posts
From the Asset Store
Latency independent responsive controls. Beginner friendly documented.
  • Hi,

    My game contains hundreds of text objects which display information about ship stats. For example:

    Weapon 1: name

    Ammo: name + rounds

    Overload: on/off

    Weapon 2: name

    etc

    etc

    So, for each text object I have created I have used a separate text object. When I first used constructed I tried creating a new text object by copying and pasting one I had already made so I didnt have to go through the menu and re-edit and so on. I then realised that construct does not create a new text object when you copy and paste, but a new 'instance' of the object.

    My question is..am I understanding the software incorrectly by creating hundreds of individual text objects all with individual names? Could I save myself time by grouping the weapon 1 stats above into a single object and copying and pasting it to make 8 separate instances...representing all 8 weapon slots on my ship?

    I saw someone in a youtube video quickly creating duplicates of text objects/buttons and it got me really confused, as I thought construct doesnt allow you to rename object instances.

    Which makes me feel like I dont understand what an instance is in the first place...?

    Hope I'm making sense.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Generally speaking, less total objects is better. Many instances of a single object is more efficient than many separate objects. This is especially true for sprites in terms of memory use, but not as big a deal for text objects.

    It becomes slightly more complicated to pick and manipulate the correct instance, but it is not that bad if you get used to it.

    In the end if you can't notice any particular performance issues from using many objects, it is not a big deal. Personally I group all objects that serve a particular purpose as one object, and I'll use multiple objects of the same type for different areas (like UI text, data text, menu text debug text, ect.). It's mostly a matter of personal preference how you want to organize your objects and events.

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