How do I Pin to an object by UID?

1 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
  • I've got 3 car helper sprites moving round a track, all based on the same sprite.

    I'd like to pin an overlay graphic to each of them to represent a different car.

    How can I Pin > Car.UID = 1 for instance.

    They also have a unique ID assigned as a variable if that's easier.

    I feel like this should be simple but can't get my head around it.

    Thanks for any advice.

  • In the car sprite object there is 'pick by UID', you would use car pick by UID 1 - pin graphic 1 to car. Or a similar condition for compare variable if you are using that.

  • Car Pick by Unique ID =1
    Overlay1 Set position to Car
    Overlay1 Pin to Car
    
    Car Pick by Unique ID =2
    Overlay2 Set position to Car
    Overlay2 Pin to Car
    
    ...
    
    or
    Car Compare Variable CarID =1
    Overlay1 Set position to Car
    Overlay1 Pin to Car
    

    It may be easier to set up everything manually in the layout editor. You can select both sprites (car and overlay), right click the car and create hierarchy connection between them. It works better than pin.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks for the replies... i'm trying this but still not having any luck.

    How do I set the overlay position (and pin) to carcontrol with id of 0?

    I can only set the pin to CarControl in the dropdown.

    Thanks again for any help

  • The condition on the left (CarControl ID=0) will pick the instance of CarControl object with ID=0. And then all actions in this event will only be applied to that picked instance.

    Picking is one of the most important principles of programming in Construct. I suggest you start by studying a few official templates and tutorials.

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