[Suggestion] Pick any object by UID

0 favourites
  • 13 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • Ashley

    I thought it would be very helpful to have the following system event:

    • pick any object by UID

    This will allow to write more abstract an reusable code.

    Right now picking by UID is bound only to a specific object.

  • Picking only a known object by UID makes sense as otherwise how do you know what parameters are available? What behaviours, what effects, what instance variables? How do you code for that?

  • If you pick an instance from an object type you don't know in advance, how would you make an action to modify that instance? To make an action you have to pick a specific object type.

  • Ashley

    Only use universal actions like destroy, set position, move at an angle, spawn another object, set visible etc.

  • What if that object was an array?

  • ) Ok, there could be following solutions:

    1) extra condition to check for an object type, which filters out actions specific to this object

    2) limit pick any object by UID to sprite objects and call it "Pick any sprite object by UID", as it's the most used object type.

  • The work around now would be to use a global variable.

    Like if globalvariable = 1 pick all these types, =2 all these other types.

  • xoros

    The current workaround is to put every single sprite object into a BaseSprite family and every tiled background into a TiledFamily, then pick by UID. Having these base classes is useful in general especially when writing helper functions.

  • An extra condition to check the object type means you've just reinvented the ordinary "pick by UID" condition!

    To pick any instance from a plugin type, you can also use families.

  • cacotigon

    yep, that's a usefull technique.

  • xoros

    If you only need to destroy instance by UID, it is easy made in plugin.

    Edit: rex_uid2prop, Action:Destroy instance by UID.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • rexrainbow and Ashley

    I am already using your plugin to get object properties. Construct 2 or 3? definitely needs this higher level of abstraction to work with objects. e.g. something like empty/null object would be nice, where you can define custom actions, listeners, events, properties in the editor and they will appear in the event system. I know, it is possible to achieve it now with js-sdk, but would be better to have it integrated into IDE. May be something like a small text editor inside Construct, which loads a template for plugin/behavior, you can edit it and see results instantly in Construct.

  • xoros

    I could export these actions to browser's action: execJS , i.e. run js code in browser's action: execJS.

    But it is better to put js code into plugins.

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