Does Family auto-pick instance after Create?

  • Say I have a Family Fruit with 3 similar fruit objects Apple, Orange, Pear. I use System.CreateObject(Apple) to create an Apple instance, will Fruit immediately pick that Apple instance so I can use subsequent code like Fruit.X = 100, Fruit.Y = 100, etc... ?

    Right now I'm storing the UID right after the CreateObject and then doing Fruit.PickByUID after a set of conditionals. I'm hoping to clean up this code some if the subsequent Pick is unnecessary.

    Thanks for your advice

  • no, it doesn't autopick, sadly. you have to do it next tick.

  • It's actually pickable at the next toplevel event too.

  • It's actually pickable at the next toplevel event too.

    Yep, I'm doing this. It works fine. However, I'll always be on the lookout for any way to write less lines of code

  • I can't test this at the moment, but can't you get around the "next top level event" limitation by using the "pick by UID" condition. If I remember correctly, you should be able to create the sprite (or whatever) instance, and then pick the family instance by the UID of the sprite instance.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I can't test this at the moment, but can't you get around the "next top level event" limitation by using the "pick by UID" condition. If I remember correctly, you should be able to create the sprite (or whatever) instance, and then pick the family instance by the UID of the sprite instance.

    Yes I think you're right. This is what I'm doing. Pick by UID is the only pick that works immediately, in same event.. That I can see.

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