Well, that script its OK, but that can made without script, I'll explain an engine that I think you had to do from the beginning:
You have to use 4 variables, 2 for the coodinates X and Y for the rock (lets say a "Rock" and a "Button"), and the other 2 for the coordinates X and Y for the button:
The 2 variables for the rock lets call it "Rock X" and "Rock Y", and the variables for the buttom lets call it "Buttom X" and "Buttom Y"......
In the event of the rock: you do all you have to do for move the rock, and at the end, You must match the variables "Rock X" and "Rock Y" to the coodinates X and Y of the Rock....
In the event of the buttom: You must match the variables "Buttom X" and "Buttom Y" to the coodinates X and Y of the Buttom, then put a conditional branch like this:
-Conditional branch: variable [001:Buttom X]==[003:Rock X]
--Conditional branch: variable [002:Buttom Y]==[004:Rock Y]
-
:Exception
-
end
-
:Exception
-
end
Inside this conditional branch, activate a switch or do what you want to happen, and put this event in Parellel process and oviously, at the end, activate a selfswitch for desactivate the event, and its ready!!, now when you put the Rock above the buttom, something will happen....
I use this engine in game all the time, and works perfectly,
Well, the script its great, this engine is just another way to do this....
Greetings.....