Candy crush/ bejeweled like game

Hi, I am wondering if someone had an experience making match 3 games here (something like candy crush/ bejeweled 2).

I tried figuring it out in the past, but I wasn’t able to do much progress which made me unmotivated to continue.

I wanted some help on knowing what I can use (type of variables, extensions, etc…) that could help me figure it out.

(I am NOT asking for someone to make a game for me, I just want to learn how to do something new, at least for me😁)

Hi, there is an example for a Bust-a-move game that has some of the logic that is also useful for a match 3 game.

2 Likes

I did check this example, but I am not sure if it helpful for me. Bust a move is somewhat different from the Match 3 games I mentioned (I.e. Candy crush). Till now, i still haven’t fully figured out how to get the main system to work ^^;

There’s a Tetris demo that might give you some ideas.

The bubble game uses linking which might help. It sounds challenging and I might try it myself. I’d start with a rough mockup and gradually add mechanics.

1 Like

Will check the demo out, thank you! Also, good luck with trying to make the mock up/ mechanics in your project!:+1:

1 Like

Okay, so here is an update :

  1. I figered out how to make objects spawn if something got cleared (thanks to the ObjectSpawner extension)

  2. Was also able to make a small grid where the object + different shapes (giving each one of them a different animation state)

  3. Making the objects fall down into the grid (like how it is in candy crush and bejeweled)


Now, here is what I still need help with :

  1. Delete objects (if they are 3 or more vertically or horizontally next to each other)

  2. Swapping places (I think it would need the tweening behavior, but I am not sure how to approach it)

  3. Check if there is no possible options so it either shuffles or spawn an object with a sprite that matches something so it slowly become more possibe to continue matching the rest

Thanks for reading!

1 Like

There are a lot of turtorials unfortunately I didn’t see any specific to Gdevelop, so you would need to use them to create it in Gdevelop. Basically just use them for concept and technique. If you have trouble then you can ask how to do it.

The code might be lengthy but it’s very repetitive. So, you would use loops using things like [repeat] and a lot of copy/paste with small changes.

It would be a lot to try to explain the process here. It would be easier to just work in very small pieces at a time.

Take a look at some of the tutorials and we’ll help you with the implemention/conversions.

[Edit: I don’t want to come across negatively. It’s just that it’s a bit complex and I don’t know what you know, so I don’t know how detailed an answer would have to be. I’m willing to help.]

Here’s a quick overview. When you add the pieces add their tile type to an array say board[column][row]=1 (1 could mean there’s a lemon) and also add a variable(s) based on their location on the grid to the sprites so you can match the value in the array to the pieces. Board[0][0] would be the upper-left corner.

To check for matches you can go thru the array using variables like x,y. Then compare the tile type values to nearby grid positions.

Example:
board[x][y] = board[x+1][y]
board[x][y] = board[x+2][y]

This would check for 3 in a row. For Gdevelop you would need to use Variable(variable name) instead of just x but I felt that adding all of the Variable() would make it harder to read.

For other matches, you would add more checks. Like board[x+3][y] for 4 in a row. If you make it a subevent of the check for 3, you wouldn’t need to check all 4 grid/array positions.

You would save the ids or locations to a group array the you can use to delete them later. But that’s a different challenge and this is already lengthy.

1 Like

This really sounds like the op would get a lot of benefit checking out the 3 examples given in the linked objects tools extension wiki page. They are a bit daunting (at least to a beginner like me) but with a bit of study you can start seeing what’s going on. I haven’t looked at the bust a move one but just judging from the tactical one and the city builder one they would be really applicable to updating positions with movements etc on a grid.

1 Like

I don’t fully understand “linking”. I understand the concept. Unlike the bubble burst game, it’s not enough to know if the pieces are next to each other. You need to know the patterns. I intially thought of checking if they were all on the same x() or y()

I did some Googling and I think the array approach would work well. If the values of board[0][0], board[1][0] board[2][0] were all the same value that would be a match 3. add board[3][0] board[4][0] and that’s 4 or 5 in a row. You just flip the x and y for the other direction. A “T” shape would be a 3 in a row and then [1][1] and [1][2]. Although, you’d need to check for a “T” shape in each of the 4 possible directions.

I would create functions to simplify some of the code just to make things easier to understand and less repetitive. There might be better techniques that a more interactive/user friendly language like Gdevelop can do easier than a more basic language. This is just one of many ways.

I’m working on a Pipe Puzzle game. I used a 2nd sprite, collisions and casted rays. That works for me. As I learn more, I might change my approach.

3 Likes

Ah now I see what you’re saying and that approach makes a lot of sense.

(Dont worry, you didnt come off as negative)
Thank you for clearing things up for me. I will try experimenting with the method you stated👍

1 Like