# Problems counting movements.

Get help using Construct 2

### » Wed Oct 22, 2014 2:34 am

I'm making a puzzle game where you have to fit geometrical forms in a bigger form, similar to tangram. Since i'm going to transfer it to touch devices i'm using Dragn&Drop and i need to make the pieces rotate so i made a double tap function. I made a global variable to count the number of movements, so when i drag it i add +1 to it, but when I just tap or double-tap the piece it counts as movements aswell... I don't know why it's counting since i'm not moving it, can someone help me? Thanks!
B
4
Posts: 7
Reputation: 214

### » Wed Oct 22, 2014 3:44 am

You could always have the variable save the objects X,Y coordinates instead and then compare them when its dropped to +1 a moved variable if they are different than the stored ones. You could then use this variable to make the object "pop" back if they dropped it in an invalid location.
Check out my completed games on the Arcade! Capt. Doe Save the Universe! & Clicker Wizard!
B
81
S
22
G
8
Posts: 664
Reputation: 10,333

### » Wed Oct 22, 2014 4:51 am

That's a really good idea. But i just started with construct so i don't really know how to do it, could you explain a little more? Which behavior is better to compare positions?
B
4
Posts: 7
Reputation: 214

### » Wed Oct 22, 2014 6:59 am

You dont use behaviours for that.

Just save X and Y to global variable and then compare them (if new X and Y is not Saved.X, Saved.Y then add 1 to score).

Global and instance variables tutorials are very well written, check them out!
B
10
S
1
Posts: 56
Reputation: 654

### » Wed Oct 22, 2014 8:22 am

You would gather the information into a variable through the actions of an event. To get the X and Y values of an object click on the window that has its opacity reduced whenever your doing conditions/actions. This window contains all objects in your project. Find the object referenced in the condition the actions are being generated from and scroll down to X and Y... it will then read something like objectname.X in the field of the variable instead of a number.

If you post a .capx of what you have so far.. or just the part where your dragging and rotating the piece I can edit it for you to look at visually.
Check out my completed games on the Arcade! Capt. Doe Save the Universe! & Clicker Wizard!
B
81
S
22
G
8
Posts: 664
Reputation: 10,333