Ver Mensaje Individual
  #2 (permalink)  
Antiguo 18/07/2007, 08:45
Avatar de nezu
nezu
 
Fecha de Ingreso: junio-2007
Mensajes: 177
Antigüedad: 16 años, 10 meses
Puntos: 0
Re: Juego Crucigrama

aqui el codigo:

Código:
textnum=new Array(1,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18);
FlagChar=false;
dragCharLocation_y=_root.charDrag._y;
dragCharLocation_x=_root.charDrag._x;
initilized();
counterWin=0;
//Prepare vars for level depth !!!

function initilized(){
 
 blockArray=new Array(0,0,0,0,0,0,13,0,0,0,0,0,0,0,0,0,0,0,0,14,0,0,0,0,0,0,1,2,3,4,5,6,7,8,9,10,11,12,0,0,0,0,0,0,0,16,0,0,0,0,0,0,0,0,0,0,0,0,17,18,19,20,0,0,0,0,0,0,0,18,0,19,0);
 winArray= new Array();
 
 //creat new array and chek how meny char in the game to get the win number
 for (i=0;i<blockArray.length;i++){
    if(blockArray[i]!=0){
      winArray.push( blockArray[i] );
    }
 }
 col =13;
 row=7;
 cellNum=col*row;
 xBase=5;
 yBase=50;
 xspace=empty._width*1.07;
 yspace=empty._height*1.07;
 c=1;
 for(i=0;i<=cellNum-1;i++){
  if(blockArray[i]!=0){
   newE=i;
   duplicateMovieClip ( "empty", newE, i );
   set (newE add ":numtxt", blockArray[i]);
  } else {
   newE="black"+i;
   duplicateMovieClip ( "black", newE, i );
  }
   setProperty ( newE, _x, xBase+(c*Number (getProperty ( newE,_width )))+1.5 );
   setProperty ( newE, _y, yBase+(c*newE._height)+1.5 );
   c+=1;
   if(c>col){
     yBase+=34;
     c=1;
   }
 } 
 PlaceChar();


}

function PlaceChar () {
  charArry=new Array("A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z");
  n=0;
  c_char=1;
  y_char=340;
  while (n<charArry.length) {
    newchar=charArry[n];
    duplicateMovieClip ( "demochar", newchar, n+60 );
    set (newchar add ":char", charArry[n]);
    setProperty ( newchar, _x, 50+(c_char*Number (getProperty ( newchar,_width )))+1.5 );
    setProperty ( newchar, _y, y_char+(c_char*newchar._height)+1.5 );
    n+=1; 
    c_char+=1;
    if(c_char>(charArry.length/2)){
       y_char+=34;
       c_char=1;
     }
  }

}

function charChek(location,char,item,x,y){
  charPl = new Array("", "", "", "", "", "", "l", "", "", "", "", "", "", "", "", "", "", "", "", "e", "", "", "", "", "", "", "s", "a", "t", "i", "s", "f", "a", "c", "c", "i", "o", "n","");
  if(charPl[location].toUpperCase()==String (char)){
     
      set (item add ":ch", char);
     
      _root.counterWin+=1;
     //check if the game is over
        if( _root.counterWin>=winArray.length){
           _root.gotoAndPlay (3);

         }
     }
      stopDrag ();
      _root.charDrag._y=dragCharLocation_y;
      _root.charDrag._x=dragCharLocation_x;
       FlagChar=false;
  
     
   
}