So this is my first game. The player has a set amount of moves to switch blocks. At the end of their moves i need to set up an event that will check how many color matching cubes are side by side in x and y axis only. Then I will calculate a score based on how many blocks are grouped together. Does anyone know how I could possibly do this? Here is an example of the game board when the turns are completed
You need to define your rules. Are there points for the same cubes in each direction? How would you score this board? Point wise, is this what you mean?
It’s an interesting challenge but I have no idea. I want to think that the linked object tools extension might help. Although, because it’s only row and column, it might be easier to link it manually.
I need to think about it. If you link the blocks together in rows and columns, you would need a linker object because you can’t link instances of the same object together. You could then use for each object to see how many objects are linked to it. I have no idea.
Oh hey Keith… Back again… I feel like I should almost set up a direct line of communication with you at this point haha.
So I havent gotten as far as deciding how the points will be awarded. I was almost thinking like how many same colored blocks are touching squared or something. But im just trying to wrap my head around how I can even structure an event to compare the object next to it… and im assuming I would have each instance of an object check if the neighboring block has the same name maybe? As each cube in the object group has a different name based on color.
Who knows… This one seems like itll be really hard to figure out
A template for a Candy Crush game was posted. I haven’t looked at it but some of the logic might be similar to what you need.
Ill take a look. Thanks
Hey Keith. So i thought you might want to see how I figured a way to do this. Maybe it would help if you ever saw someone asking in the future. Also to see if you saw any issues with me doing it this way.
So what I did is gave all the cube objects a variable called color and obviously set it to the color of that cube. Then i set a scene variable for current location x and y. Also a scene variable for firstcolor and secondcolor. And the rest you can see on the example below
Ignore the name of the text change in the bottom three actions. Thats an old text placeholder on screen i used to just check if this solution worked
Good to hear. I’ve been playing with the concept. I might have overthought your concept but I created a project that creates a 6 X 6 grid, counts the colors and puts the totals in a structure of structures. It only counts by column, to do rows, you would just need to reverse the counter. increase row where it;s column and column where it increases row. Use as much or as little of this as you choose to.
Click the green [code] button and select [download zip] then open the json file with Gdevelop
Try me, there’s just one button to click
This is part of the Data structure of structures. Each color has a structure with the number of colors in a row sequentially and the the number of times like blue had 1 color in sequence 7 times.
It’s a lot if you’re still learning. We are all still learning. I tried to add comments. It should automatically adapt to any number of colors in the tile object
Thats awesome. Thanks Keith
This is actually super helpful to my current project too. And I can see it being useful in so many types of games, either as is or as a building block for modification.
It started out much more complicated but then I tried to flowchart it crudely in Krita as a drawing. I kept asking myself, how would I do it in the real world. It had like 4 scenarios and another variable or two. I managed to surprisingly significantly simplify it. Identifying the first and last move or tile was the key element. I then removed duplicate actions. The grid behavior was a time saver. I usually add more own objects but I love the way it adds the row and column,
I hadn’t planned on using the grid behavior in my project (huge fan of Victris Games extensions but my project grid seemed too small to need an extension). But after I saw how cleverly you implemented it into your logic, I got pretty excited about the possibility to modify the extension a bit to also set a random number variable representing one of my various tiles into each cell on creation. And hopefully finagling your logic into the board creation too, to detect and prevent matches while the board is created. If I can’t figure out for sure how to do that while it’s creating the board, I know I can tweak it to run after the board is created and eliminate any matches before showing to the player. Then I can use it to run after each move to look for matches. And I think I might be able (??) to modify it to detect possible matches (which I would like for a hint system and to detect no possible matches left). But that part is less important, since I tend to start with simple projects and add advanced features later as I figure them out. Until then I can just let the player win a prize everytime they run out of moves or something to keep their spirits up. So yeh I was pretty happy to see your project when I woke up this morning because it made like half of my project figured out already.