playMaker

Author Topic: simple Memory Game that uses a 2D array of tiles.  (Read 2998 times)

mickman

  • Junior Playmaker
  • **
  • Posts: 62
simple Memory Game that uses a 2D array of tiles.
« on: July 16, 2014, 08:55:01 AM »
I am about to start building a game utilising PlayMaker
 Game Overview:
  a Player controls a small character that jumps from tile to tile  copying a sequence of coloured tiles that light up randomly.  e.g..  red,red,yellow,blue..   
The character controller will be the trigger for each tile... I have the character hopping from tile to tile wherever I tap... But

It's the game code I'm not so sure about.  I want to save each randomly generated sequence & then do a comparison check ? The actual dance floor is a simple disco style floor... a   2D array  4 x 4 tiles.  Level one would be a simple 2x2 array & other levels might be a max. 6 x 6 grid layout.

So for example:
a sequence of red / red / blue / yellow tiles light up.
Player taps the same sequence
Correct = Applause & score updates.
Wrong  = negative sound score subtracted

So how would I start this in Playmaker ??... 
Generate  a random pattern  & then match the pattern ?

Hope someone can point me in the right direction...

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15496
  • Official Playmaker Support
Re: simple Memory Game that uses a 2D array of tiles.
« Reply #1 on: July 18, 2014, 08:30:49 AM »
Hi,

 Typically, yes, ArrayMaker will save the day here:

 have a unique id for each of your tiles ( "11","12") you are good with this as long as you don't have more than 9 items per row or column).

then in arrayMaker have a arrayList describing the sequence by simply refering to these ids, and as the user performs actions, you keep track of the index ( the progression) in that array, if he hits a tile that is indeed at the current index, he's right and you can increment to the next index, if it's wrong, then the user failed the sequence.

 Does that make sense?

bye,

 Jean