How to set up a match 3 game in corona

I have tried to start with collision, when they collide, it will remove the gem. However I can only match with 2 different gems.

After that I search online and found corona crush, and I read a couple times, I understand a little bit of the code. And I mainly don’t understand how the physics raycast works.

Do you guys have an other ways to do the match 3 game!?
(Not using physics Ray cast ) or tell me how raycast work

Honestly I would go with Raycasting, it’s exactly what you’re looking for and will fix the issue you have with only matching 2 different gems. rayCast will detect all physics objects along a given path so you can detect 3, 4, 5 or more gems with a minimal amount of code.

I would start with this tutorial: https://coronalabs.com/blog/2013/05/07/physics-raycasting-and-reflection/

Experiment with a tiny bit of code to start with until it all makes sense.

P.S. Do you really want to make yet another candy crush clone?

No, I’m not trying to make another clone, I’m just trying to learn how match 3 works

I have spent a day to study the corona crush and i finally understand a bit, and i also learn how to use raycast

but i have a further question about raycast. if u trigger the raycast function, will the raycast stay in the screen or it will disappear after the detection. 

Also, the tutorial that u gave me says that “if an object resides in the firing path of a gun, “the line-of-sight” of an NPC”

about the line of sight of an npc part, i don’t get how raycast work.

i understand that u can set raycast to closest or sorted. but the raycast won’t last so long and keep detecting others, so how can the npc detect enemies with raycast??

Thanks for answering me!! :slight_smile:

I don’t know much about raycasting, but it’s not something that lasts.  You aim it and it returns either to you the closest thing it passes through or a sortest list of objects that the ray passed through.   It’s not long lasting I don’t think…

Rob

Honestly I would go with Raycasting, it’s exactly what you’re looking for and will fix the issue you have with only matching 2 different gems. rayCast will detect all physics objects along a given path so you can detect 3, 4, 5 or more gems with a minimal amount of code.

I would start with this tutorial: https://coronalabs.com/blog/2013/05/07/physics-raycasting-and-reflection/

Experiment with a tiny bit of code to start with until it all makes sense.

P.S. Do you really want to make yet another candy crush clone?

No, I’m not trying to make another clone, I’m just trying to learn how match 3 works

I have spent a day to study the corona crush and i finally understand a bit, and i also learn how to use raycast

but i have a further question about raycast. if u trigger the raycast function, will the raycast stay in the screen or it will disappear after the detection. 

Also, the tutorial that u gave me says that “if an object resides in the firing path of a gun, “the line-of-sight” of an NPC”

about the line of sight of an npc part, i don’t get how raycast work.

i understand that u can set raycast to closest or sorted. but the raycast won’t last so long and keep detecting others, so how can the npc detect enemies with raycast??

Thanks for answering me!! :slight_smile:

I don’t know much about raycasting, but it’s not something that lasts.  You aim it and it returns either to you the closest thing it passes through or a sortest list of objects that the ray passed through.   It’s not long lasting I don’t think…

Rob