Problems counting movements.

  • 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!

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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.

  • 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?

  • 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!

  • 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.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)