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