# how drop and drag a object in a exact position?

Get help using Construct 2

### » Sat Aug 04, 2012 4:16 am

hi guys i have a question well really iam making a animal cell game and i want the kid drag a part of the cell and when he drop in wrong place the cell part comes to original position until he put the part in correct place

PD: i hope understand me :(
B
8
S
1
Posts: 15
Reputation: 851

### » Sat Aug 04, 2012 4:20 am

Soon as the object is touched, record it's x and y position to a variable, then if it not in the right place, put it back to the positions in the variables.

Is that what you mean?
B
101
S
32
G
12
Posts: 1,549
Reputation: 22,103

### » Sat Aug 04, 2012 5:24 am

yep that i mean D: but can do a example ?
B
8
S
1
Posts: 15
Reputation: 851

### » Sat Aug 04, 2012 6:46 am

If you want an animation of the organelle going back to the origin when placed in an incorrect spot;

I'd

1) make an copy of the organelle in the correct spot with outlining collision points, and then make it invisible.

2) Make an event; that if the organelle overlaps it's invisible counterpart while the mouse button is released, then "yay... a kid wins a gold star" .... but... if else then goto bullet point three

3) As ArcadEd suggested; record the X:Y coordinates. Also record the X:Y of where the organelle was dropped. Make a "for:next" loop stepping one: from 1 to 10 (sorry if I used the wrong terminology)

4) Subtract the origin coordinates from the the coordinates of where it is dropped. Divide the difference by ten and multiply by the step of the for/next loop.

5) Display the organelle each step

It would be a little choppy, but that number 10 could be adjusted for that.
B
3
Posts: 7
Reputation: 389

### » Sat Aug 04, 2012 7:27 am

:O ok i got it thanks felinous and arcaded iam going try the steps :3
B
8
S
1
Posts: 15
Reputation: 851