Question about example-project (instance variables.capx)

0 favourites
  • 3 posts
From the Asset Store
Easily store, modify, read and manipulate colors with Color Variables!
  • I can't understand how the text instances get the correct sprite instance count values!

    How are the text instances connected to the sprite instances ?!

    My head is exploding please help lol

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • As commented in the example:

    [quote:3cdpqirq]Note Construct 2 pairs up instances by default, so this action will get the corresponding sprite's instance variable, as long as there is an equal number of text and sprite objects.

    I guess this is a shortcut where expressions assume the IID of the currently picked object. I've been using C2 for 5 years now and I didn't even realize this existed... I can't find anything in the manual that documents this. Still, I wouldn't rely on it, as placement order matters and things can get messed up as you create/destroy objects or if you don't have equal instances of each object.

    Containers would be a more suitable method. Alternatively you can assign label/debug text an instance variable with the UID of the object it is supposed to be associated with, and use that to pick the correct objects to update the text with.

  • Thanks for your reply. I read the comment in the example before but it does not reveal anything about the logic behind the entanglement. I agree with you it's nothing I would like to rely on.

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