I’m creating a bubble shooter and although i have most parts working i’m stuck at the part where a ball should be aligned to a grid, and tracking wich balls are attached to the other.
I got to the part to create a grid and saving positions to an array, but i can’t seem to figure out how to compare it to the values of the array, and i still have no idea how i’m going to implement the tracking of the attached balls…
Here’s the script wich creates the grid, the balls have seperate scripts.
var positionPrefab : Transform;
;
function Start ()
{
for(var u : int = 0; u < 17; u++)
{
for(var v : int = 0; v < 15; v++)
{
Instantiate(positionPrefab, Vector3((u * 10) -75, (v * 10) - 70, 0), Quaternion.identity);
}
}
var gridPositions = GameObject.FindGameObjectsWithTag("gridPosition");
var positionLength = gridPositions.length;
var positions :Vector3[] = new Vector3[positionLength];
for(var i = 0; i < positionLength; i++)
{
positions _= gridPositions*.transform.position;*_
* //player[0].transform.position.x;*
_ print(positions*);
}
}*_
function Update ()
{
}