Question about example-project (instance variables.capx)

0 favourites
  • 3 posts
From the Asset Store
With this template you can create your own archer game and customize it however you want.
  • 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

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

  • Try Construct 3

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

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