Help needed about picking

hi… I’m trying to make a classic puzzle game to test my understanding of :logo_gdevelop: and grow my knowledge, experience about it.

I’ve made 9 tiles as board tiles to help me in creating system of movement.
every instance of board tile has its id.
tile object variable id =0, for instance 1 =1 ,instance 2=2 …etc.
on top of board tiles there is 8 green tiles which can be moved.
every instance of tile has its id based on scene array variable so I can shuffle tiles every beginning of scene.
shuffling and movement systems are succeed.

now I want to learn how to make system of winning based on picking instance of tile and check if it’s on the board with same id.
if 8 tiles on 8 board tiles with same id, player wins.
I’ve tried many things
in events but didn’t work because there is always a collision between tile and board and ids are equals too so its true, what should I do :sweat_smile:


2024-03-13 23-28-34

I don’t understand why you can’t loop through all the tiles when a tile has been moved, check the board tile the centre point of the tile is in and compare their 2 ids.

I’m suggesting the point check and not collision because if the tiles are tightly placed together, there is the possibility that a tile also collides with an adjacent board tile.

I don’t know how to loop “through” all
I know repeat event certain times
I use collision overlapping not touching
I still don’t get it, how to do that?
oh I’ve tried repeat for each object, didn’t work

Try something like this:


this event don’t specify which board
oh I will try it not equal

It does (the collision check makes sure of that), but you should change the order of the conditions. Get the objects first, then the specifics of the objects

it didn’t work :face_with_spiral_eyes:
I think I understand the concept of picking 2 collides objects
but I don’t understand why its not working

Then try “The point is in” condition. Make the check for Tile.X() & Tile.Y() is in BaseTile.

If that doesn’t work, then post a screen snip of your events.

It’s not free, but this example may help:

not working…tile.x() is just a point not specified as certain abject to pick
the problem is in picking I think

To check, have you given the board objects and tile objects their correct id values?

yea , sure , I’m using debugger to be certain of this
9 boards 8 tiles

Ok, I’m scratching my head a bit now. If you’re comfortable with it, would you mind zipping your project and linking to it on a shared drive so I can download it and check it out? You can PM me if you’re not fond of making it publicly available.

You’ve left out the unconditional event that sets the boolean variable match to true before checking if all the board and tile ids are the same.

delete it and system of winning will not work too

I just added it to the project you shared with me, and it worked…

so share it again, lemme see what you have done
ah srry wait
no , if its true player wins

I think I got it , thx so much, every day I learn something
so I have to start scene with condition of wining is true to trigger the condition of making it false :melting_face:

You change the condition of winning to true every time before you check if there are any conditions that make it false. Otherwise the it doesn’t get reset the after it gets set to false.

1 Like