playMaker

Author Topic: Creating Mahjong style object array question  (Read 2425 times)

coffeeANDsoda

  • Hero Member
  • *****
  • Posts: 618
Creating Mahjong style object array question
« on: January 12, 2016, 05:09:24 PM »
As I'm trying to wrap my head around using arrays to destroy the same or similar object pre fabs with a trigger, I had a idea for prototype game similar to this one.  I know that this game is structured in a way where objects aren't destroyed, but mahjong can be a very complicated game to design with multiple patterns of lining up similar tiles in-game.

Skip through a couple minutes to get to the mini game itself.



To keeps things more simplified, I thought about using a game manager(that's a prefab to destroy the same or similar prefab objects). Don't understand how this could be pulled off. Wouldn't I have to set up a big cube trigger that can detect other prefab game objs so when more than two tiles are lined up close to each other they can be destroyed?



jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15620
  • Official Playmaker Support
Re: Creating Mahjong style object array question
« Reply #1 on: January 13, 2016, 01:44:59 AM »
Hi,

 That's going to be tricky indeed...

I would have each line defined as an array, and then I would go trhough them an apply the rules. I would personnaly prefer this instead of relying on physics triggers.

 Bye

Jean

coffeeANDsoda

  • Hero Member
  • *****
  • Posts: 618
Re: Creating Mahjong style object array question
« Reply #2 on: January 13, 2016, 04:21:07 AM »
Hi,

 That's going to be tricky indeed...

I would have each line defined as an array, and then I would go trhough them an apply the rules. I would personnaly prefer this instead of relying on physics triggers.

Each line or row defined as an array? Without string variable? Or setting up a cube trigger?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15620
  • Official Playmaker Support
Re: Creating Mahjong style object array question
« Reply #3 on: January 26, 2016, 07:24:38 AM »
Hi,

yes, each row and column should be express as indivual lists, so that you can go trhough each one of them and check their content. as you go trhough them and apply the same routine, you'll find if one of them has a winning combination.

as for setting up a cube as a trigger, I would not do this, it implies too much maths and recursive operations to go trhough the board just using triggers... it would be a nightmare...

prefer creating a representation of the board in memory, specifically designed to make your life easier when checking the board.


Bye,

 Jean