Issues with instance UIDs for dynamically created objects

0 favourites
  • 5 posts
From the Asset Store
UID TO ANYTHING
$18 USD
20% off
Act on your instances, get/set their properties and variables only thanks to their UID. No more picking trouble! Plugin
  • Hi!

    I've got some issues in my program. The idea is that when you hold the key "c" and click on two nodes the nodes will be connected by a black "wire". And if you press "a" you can create more nodes. Everything is shown in the video below. It all works well for the objects created in the editor. But when adding new objects by pressing a and clicking a free spot the connection feature won't work anymore. See the video here: http://youtu.be/sztt1364HlU

    Here is my .capx file as well: http://www.mediafire.com/download/q6q5w ... oblem.capx

    I will be very thankful if someone can tell me what I've done wrong. Perhaps it's just something silly that I've missed. <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile">

    The positioning of the wire object is decided by the nodes UIDs as you'll see in the code. But as it all works with objects created before running the program I don't know what's wrong really.

    Some of the logic in the program is a bit wierdly implemented but it's a quite small program after all so I think you'll be able to see what's going on.

  • The Sprite(0) expression references the sprite with IID 0, not UID. It's just a coincidence that the sprites on the layout have UIDs that line up with their IIDs so the events work for them.

  • Oh.. Well that was a silly problem.. Thank you! But are there any similar way to select instances with a specific UID? As I'm using two UIDs in the same event I can't "pick by UID".

    I got it working by first getting the UIDs and then from the UIDs I selected the correc IIDs to use. The issue then is that if you delete a node the IIDs will change. Which means I would not too run a routine to update all connections to use the right IIDs. So it would be more neat if you could use the UIDs directly in an expression.

  • You can add the Node to a family "NodeFamily" and then pick Node by UID for the first one and pick NodeFamily by UID for the second one. Then you can create a wire at Node.X, Node.Y and set it's angle towards NodeFamily.X, NodeFamily.Y.

    The other way to do it would be to pick one Node by UID first and store it's x,y values in local variables. Then pick the second node and do your thing.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thank you ramones, sorry for my late reply but I think you're idea will work just fine.

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