Figure counting

Good afternoon I am new to the program. Just a week. I made a scene that displays 6 shapes. The user arranges the figurines in certain places corresponding to the coordinates. When the figurine is in its place and the player releases the figurine, the figurine has become inactive, I change the counter to 1. But when you click again, the counter also changes. How many times I click on the figure or on an empty space, the counter is constantly added. I took one figure and put it in place on counter 1. If I take the second figure and put it in place, then it is already 3 on the counter. How can I get around this?

You need to add the condition “the cursor/touch is on your object”. You just defined to add 1 when click is released, no matter when.

When you click on the object again, the counter changes anyway. I set the condition “Run only 1 time”, the situation does not change. Once again I click on the object and the counter changes.

Why are using array?
I guess you need to use object variable for each object
or a boolean variable and according the cursor is pressed or not you toogle it (true/false)
I really don´t understand the logic in your code.
Why are you randomizing the variable Figures?

This is my first project. It works, but not the way I want. I need it so that if the figure falls into place (in the given coordinates) and when the user releases the figure, it should become inactive and the counter increases by 1. when all the figures are in their places, which means the counter is equal to the number of figures in their places, then you can make a gameover. I use the array to display the figures in random order when loading the scene

I know what I did as a noob :). The game works, but not as it should work and the code is not correct and not aesthetic

1 Like

Thank you. I did. I have used object variables. When the orobekt got to the right coordinates, I changed its variable by 1. Then I just compared if the object variable =1 then I make the object unavailable for dragging and increase the SCORE by 1. And Trigger once. Everything seems to be working great. Thank you

Yes, now that I see what your game is about , the code could be drastically reduced using another aproach, for instance, using “distance between two objects”, instead of checking coordinates and also using a single scene variable adding 1 for each hit, making the code more efficient.
Just a warning! Do not use “Scene Variable” to store your score, but “Global Variable” instead. Scene Variable does not keep the value when you change scene.

1 Like