playMaker

Author Topic: Interacting with Objects 2D Array (Prefabs)  (Read 2262 times)

Ffz

  • Playmaker Newbie
  • *
  • Posts: 5
Interacting with Objects 2D Array (Prefabs)
« on: July 01, 2013, 05:07:00 AM »
Hi there,

So I've created an array of prefabs from my script and the look awesome, I can now touch the objects and move them around. The next trick is to do some match 3 type functions on the objects, what is the best way to interact with the objects?

Via the initial script, directly on the objects? Tag/Find? Add to Array?

Ideally I would like to create a 2d array of the objects and iterate through it to work out how many in a row on x,y and then destroy/instantiate.

I have no experience with arraymaker as yet.

thanks,

Ffz

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Interacting with Objects 2D Array (Prefabs)
« Reply #1 on: July 01, 2013, 07:36:49 AM »
Hi,

 ArrayMaker doesn't support 2d arrays unfortunatly. What you can do tho is have one array per row and store all items on that row, so if you have a 4 by 4 grid, you will have 4 arrays, each containing 4 items.

build these 4 arrays on one game object and use the "reference" property to name them uniquely, like "Row 1" "Row 2" etc etc. then when you want to access an item of a specific row use array actions and don't forget to properly match the reference to access to row you want ( else it takes the first array defined on that gameobject)

You can check y sample on arrayMaker called "three in a row game" this will be a good bases for you to start with this and see how far this can be taken.

bye,

 Jean