Move to the location of a UID

0 favourites
  • 7 posts
From the Asset Store
This is a code so you can see the same skin on all screens (peers). Each peer gets a skin, in addition to 4 directions t
  • I'm not entirely sure how I can best word this, but here goes...

    Lets say I have the UID of an object stored in a global variable. How would I go about setting the X and Y positions of another object to match the position of the object that I have stored the UID of..?

    So in other words, how do I move one sprite to the location of another via it's UID rather than the sprite itself?

  • You would have to refer to the object to get it's location. You would pick by UID, and then look at the X & Y of what was picked.

  • Perfect! That helped a bunch.

    Thanks!

  • Hello,

    I add behavior move to to an object but there is no MOVE TO UID among the options.

    I tried to ask the System check if UID exists or pick object by instance but no good.

    There are all other options of the behavior and they work just fine... but MOVE TO UID is missing.

    What i want to do is choose between UID values from the same sprite and then move to it.

    like random.

    If anyone has an idea please help.

    Do i need to unnistall and install again the behavior?

  • RBARON85

    You have to do this in 2 steps:

    Step 1. Pick an instance of the sprite.

    You can use any method to pick an instance:

    Sprite->Pick by unique ID - if you know the UID

    System->Pick random - if you want a random instance

    Sprite->Pick nearest/furthest

    etc.

    Step 2. Move to (Sprite.X, Sprite.Y) position.

    Again, there are plenty of ways to do this. The easiest is MoveTo behavior, or you can use Bullet, LiteTween or simply move your object a couple of pixels towards (Sprite.X, Sprite.Y) on every tick.

    Note: Step 2 should be a sub-event to step 1.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • dop 2000 I did it !

    It is working!

    Thanks!

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