unity3d - How to make a 15 sliding puzzle game? -


i have created game has 16 spheres in , swapping on mouse click. want have 15 spheres , 1 empty gameobject, make them slide of empty gameobject.and want shuffle spheres when game starts each time. how possible?

i follow this tutorial

after tried make it, cubes overlapped on 1 while changing position on start.

var xtemp ;     var ytemp ;          var slot : transform;         var cubesposition : vector3[]  = new vector3[16];      var cubegameobjects: gameobject[] = new gameobject[16];         function start ()          {              changeposition();            assignpositions();          }           function changeposition()         {         for(var i=0;i<cubegameobjects.length;i++)         {          cubegameobjects[i].transform.position;         }          slot.transform.position = new vector3(random.range (1,4),random.range (1,4),10);          }       function assignpositions()       {           (var = 0; < cubesposition.length; ++i)           cubegameobjects[i].transform.position = cubesposition[i];      }         function onmouseup() {      if(vector3.distance(transform.position,slot.position)==1)     {     xtemp = transform.position.x;     ytemp = transform.position.y;     transform.position.x=slot.position.x;     transform.position.y=slot.position.y;     slot.position.x = xtemp;     slot.position.y = ytemp;      } 


Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -