Move to the location of a UID

Get help using Construct 2

Post » Fri Jul 05, 2013 8:05 am

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?Sean Noonan2013-07-05 08:07:42
B
45
S
9
G
2
Posts: 143
Reputation: 4,201

Post » Fri Jul 05, 2013 8:14 am

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.
B
242
S
63
G
33
Posts: 903
Reputation: 40,756

Post » Fri Jul 05, 2013 8:26 am

New to Construct ? Where to start

Image Image

Image Image

Please attach a capx to any help request or bug report !
Moderator
B
296
S
119
G
96
Posts: 7,329
Reputation: 71,300

Post » Sat Jul 06, 2013 7:03 am

Perfect! That helped a bunch.

Thanks!
B
45
S
9
G
2
Posts: 143
Reputation: 4,201

Post » Fri Dec 08, 2017 8:25 pm

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?
B
8
S
1
Posts: 6
Reputation: 416

Post » Sat Dec 09, 2017 3:50 am

@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.
Image

Did I help to fix a problem in your game? You can buy me a cup of coffee :)
B
17
S
9
G
70
Posts: 1,049
Reputation: 38,161

Post » Tue Dec 12, 2017 10:02 am

dop 2000 I did it !

It is working!

Thanks!
B
8
S
1
Posts: 6
Reputation: 416


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 11 guests