How do you find the position of a clone?



Short little question...

How do you find the X and Y position of a clone? I've seen it before, but I forgot...

Like, if I needed another object to Set Position to a clone (not the original object), how would I do that?



This post was flagged by the community and is temporarily hidden.


Why are you so depressed????????


Ok, I get it, It is not like have experienced anything scary or something???!?!??!? Looks around to check if nothing is around or any paranormal stuff. Swrry, I saw some creepy stuff before in my h0N3 b3f043. Trying to keep it decoded.


Okay, let's get back on topic!


Back to the question, it is not as straightforward to get the X and Y locations of a clone, as it is to get the X and Y locations of a base object. It can still be done, however. You just have to be willing to jump through some hoops.

I will give you one possible hack. When you create a clone, you can give it a number, often referred to as an "Index". The way you could do that is to assign its number to some other property, like its invisibility or "speed" (which I almost never need for anything else) or size. That means that this property is no longer available for its original purpose.

Once you have assigned the clone number by whatever method suits you, you can use and "if _ equals [index]" and then read the "X position" and "Y position". It's clunky, but it works. I think that may be very similar to what has been suggested above. Not sure. If it would be helpful, I can make an example project that shows this. Interesting?


That'd be great! I thought it had something to do with using a value like "rotation" or something like that, but I never really understood how to apply that.


I would be happy to give you something that is helpful. If you don't mind waiting a few minutes, and assuming that hopscotch will still be up, I will try to make something and bring it to your attention. By the way, yes, you can use "rotation" as the index as well, if you don't mind the fact that your object will be rotated. You have probably understood more than you give yourself credit for. :slight_smile:


Can you post a project for it? And give me the link for it!


I guess you could make the clone set a value to it's x position and another to it's y, then make another object set the text to them.


Got distracted for a minute. Here's a link:

Read Clone XY


You could use speed?


I do. In fact, that's my favorite property to hack as an ID for a clone, to give it a serial number or to keep up with some other made-up property. Since I don't use the "change [x or y] by... " or "turn..." or "go forward..." commands, it makes sense to use "speed" for something other than its original purpose.


You should know, I learnt in from you in your 4D4U, I even know most of the code now!


That's great. I'll be thrilled to see you make something way cooler with it!