a little request

0 favourites
  • 7 posts
From the Asset Store
Help the cute broccoli to get past all obstacles in his way!
  • it would be super helpful if I could compare objects' UIDs.

    imagine you have a sprite "foo" and sprite "bar" pinned to "foo" and you want to destroy "bar" on "foo" destroyed. currently thr only ways to do that is to store "bar"'s UID in "foo"'s instance variable "barsuid":

    on foo destroyed

    pick bar by uid = foo.barsuid

    -- destroy bar

    or to loop through all "bar"'s on destroying "foo":

    on foo destroyed

    • for every bar
    • system->compare (bar.pinned_object_uid == foo.uid)

    --> destroy bar

    this addition would change not so much, but it would be clearer:

    on foo destroyed

    foo.uid == bar.pinned_object_uid

    --> destroy bar

    hope it would not be too much to ask :)

  • you can also store the an instance variable of foo too.

    http://www.scirra.com/tutorials/361/understanding-uid-iid-health-cards-and-rocket-smoke-trail

    If you place the bar on the screen, fill the instance variable "ID" with your desired ID, or, on creating it, set its ID on the same event.

  • yea, but the thing is, say, I have a sprite with 100 pinned objects to it, and i want to destroy all of them when sprite is destroyed - ergo 100 instance variables? :) there are messy and could be easily dropped with this "compare uid" condition, also, there's "pick by uid" condition which is similar, but other way around, right?

  • you're right, that was only another way to do it. Also, you can use family. Place all the pinned objects inside a new family for that object and then destroy the family.

    Many ways.

  • well yea, but every way is kinda messy, and this new addition would make things very clear I think :)

  • You're asking for an event which says "Pick the instance of Bar whose Bar.PinnedUID expression matches the currently picked Foo UID". This is not easy to express in Construct 2's event system in a single condition. It goes against the typical way conditions work. To be honest I don't see anything wrong with the first or second examples. I guess containers would help here as well, they're still on our todo list.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • if containers would help, and if they are on todo list, that's enough for me :)

    cheers.

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