How do I make a sprite instance that has an instance number?

0 favourites
  • 8 posts
From the Asset Store
Jump on numbers in the proper order and reach the sun!
  • I'm trying to chain instances of a sprite together similar to the way they're chained in the Example: Pin chain style

    In the example, each instance of Blob has a number. However when I try to do this with my own layout, copies of my sprite don't have anyway to set the instance number under Instance Variables.

    So I'm wondering, how do I enable the instance number option for a sprite?

    Thanks!

  • by clicking add/edit instance variable under instance variables in the object's properties-bar..

  • by clicking add/edit instance variable under instance variables in the object's properties-bar..

    Yes that is the only option I can find, however that is not how it is done in the example.

    In the example, the blob "number" value, auto increments every time you copy and paste an instance to the layout. So it seems to be an auto-generated instance variable. It only appears in the Properties but not in the Instance variables editor window.

    I thought it may have something to do with Families but adding my sprite to a family didn't seem to make any difference.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You are talking about the UID?

    That one increases automatically, but the instance variable "number", which is used in the event sheet to make the chain has to be changed manually.

    from the manual:

    inst.uid (read-only)

    The instance's unique ID. Construct 2 issues the first instance a UID of 0 and increments by 1 for each new instance created. UIDs must never change through the life of an object.

    inst.instance_vars[]

    Array of instance variables. Each element is an ordinary javascript value corresponding to the current value of the instance variable at that index.

  • Yes, thank you LittleStain!

    I think I was getting the two confused especially as maybe there is glitch in the example so its not showing the instance variable "number" in the editor.

    Thanks for helping me out!

  • For a while I still couldn't get this to work until I noticed that the instance variable in the example belongs to the family BlobFamily not the Blob.

  • if blob is included in the family then he gets all families instance vars.

  • if blob is included in the family then he gets all families instance vars.

    Yes, thanks for clarifying that!

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