call a instance from a string variable...

I have a puzzle group with 16 different sprites.
What I need to do is record the real name of the first clicked object, and after a second click, change the position (X, Y) of the two sprites.

I can already differentiate a click from a second click with a variable.

In the first click I record the position X and Y of the first clicked sprite.

In the second click I record the X and Y position of the selected sprite and then move it to the X and Y position of the first one.

But I can not call the sprite from the first click and perform an action on it. Here I’m taking a beating.

can anybody help me?

Try to remember the first instance: When you pick the first instance, save its X and Y position as you’re doing right now, but also create an object variable “first” = 1 in the first instance. After picking and moving the second instance, pick the first one checking the “first” variable and move it to the saved second position. Then reset the “first” variable to 0 for future picks:

[code]Conditions: Click on MyObject
Actions: Do = MyObject.X() to the variable X1
Do = MyObject.Y() to the variable Y1
Do = 1 to the variable “first” of MyObject

// Don’t know in which way you’re doing it, but this event doesn’t run if the previous one does
Conditions: Click on MyObject
Actions: Do = MyObject.X() to the variable X2
Do = MyObject.Y() to the variable Y2
Do = Variable(X1) ; = Variable(Y1) to the position of MyObject

    // sub-event
    Conditions: Pick all MyObject
                Variable "first" of MyObject is = 1
    Actions: Do = Variable(X2) ; = Variable(Y2) to the position of MyObject
             Do = 0 to the variable "first" of MyObject[/code]

Thank you Lizard-13.
it works.

God bless you and good studies.

Hi dinobit,

I’m having same trouble with you. Could you help me with it? I just don’t understand @Lizard-13 code.
Thank you.