I’m new to gdevelop and thought as a first project to learn it I would create a Match-3-Game like Candy Crush or the countless others of the genre.
Anyway what I have so far: I’ve got a group with 5 objects (the different gems) and I managed to make a 5x5 grid of those objects mixed randomly - Probably it will be a bigger playing field in the end (like 10x10 or something), but for testing purposes I wanted to keep it small first - also that’s why I created it with the loop instead of placing the objects by hand, so that I can scale it more easily later on.
So my next thought was to track the coordinates of the instances of those gem-instances, so if I drag one of the gems over another it locks in to it’s new spot and the other gem jumps to the now empty spot of the gem a dragged. And of course I need to do the checks for matches after that, but first I want to get the basic movements to work.
My problem is I don’t know how to track the coordinates and I also if I had that problem solved I don’t know how to move the other instance away by coordinates. I hope everything I wrote is understandable - English isn’t my first language.
Also is there a list somewhere where I can see all the available commands of Gdevelop (maybe even with a quick example)? For example the ‘GlobalVariableChildCount()’-command - I only discovered that by accident in a Youtube-Tutorial.
P.S: If it helps I can upload the game files, too, but it’s not much content in it yet.
Thank you for the link MrMen that helps a lot. So according to the link I could use the command Object.X() and Object.Y() to get the coordinates of an object. Ok so now I need to figure out how to select a specific instance of an object and than I’m almost there. I’ll test around a bit later and come back if I can’t figure out the rest.
I have some basic idea of how to do it but i guess it would be problematic if you would get into matching 4 or more
Idea would be to use tiles under your objects
Imagine chess and checkerboard
That board could be invisible for all you care but would need to be built from separate tiles so each square is one object
And when your objects (gems) land they could touch only one tile at a time
Now what you would do is when they all landed you set some variable to each board tile or even change their opacity
And use that as indicator
For example for tile that is in collision with yellow gem could have variable 1 and give set that tile variable also to 1
Or if board tile is in collision with yellow gem you set tile opacity to 1
2 for red 3 for green and so go on
Now you could use raycast to cast a ray from tile against gems
In whatever directions you want
And it is essential you cast a ray from different object from against which you cast a ray to avoid conflict
Heck it would even work with checking point inside object
And you would check if var of tile equal 1 and center point of that tile -/+ to the left and right is inside yellow game then you would set boolean variable of these gems to true so it can be destroyed later
And that is just for checking left and right where i guess you would want to destroy also up and down and diagonals
Also you would need variable to set some turns
So like when gems are dropping you set Turn variable to 0 when all landed and do not move you set Turn var to 1 where now it checks adjacent gems
After it is done you change Turn var to 2 where now all that being checked and qualifies to being destroyed gets destroyed
I have very Fankenstein idea of doing it and it would be complicated
If you won’t figure it out or someone will not come here with better/more simple idea
Think of my idea as your last resort and not 1st option
I bet there is easier way to do it i just can’t picture it