Two problems with a puzzle

I’m doing a very simple puzzle. Nine photos have to match in nine boxes.
Each square and piece has an object variable called “location”. It is a numerical variable. With a value from 1 to 9. If the piece matches the corresponding box, it generates a hit.
But when I count the successes, if there is only one success, it is always counted.

Second problem. By pressing the right button on a piece I order it to be placed in the original position. But the piece always goes to the x axis = 0. Each piece has an object variable that indicates the position of X. But it always goes to position X = 0

Can anyone help me?


Second 53: Clicking right button
1minute 24 sec: Counting cells


Could you explain the problem a bit more in detail? What I understand is that if you have one match it is counted as such - but that’s obviously not what you want.

This is because the value of your object variable is 0 or the object variable cannot be used/found by Gdevelop. In the latter case it puts 0 as a default value. In your events I can just see one object “piezas” and for the x-position you set the object variable eje_X. What is the value of eje_X? You don’t change it anywhere in the events. Where are the other objects you want to place?

1 Like

In the first problem, if you look at the video at minute 1:19 it looks very good.
When a piece is in the right place it starts counting successes infinitely. And what I want, logically, is for a success to count.

in the second problem. All pieces have an instance variable that indicates the position of X. You can see in the photo.

Gracias. Thanks

In the bottom of your screenshot it says there’s an undeclared variable. I think the letter case for the letter x doesn’t match. It’s upper case in the scene but lower case in the setup.

The counter issue seems to be bacause the counter variable is only set to 0 once with an at the beginning. The counter needs to be reset each time or it just keeps adding and adding.

Try removing the at the beginning condition .

1 Like