Advertisement
Guest User

Untitled

a guest
Dec 22nd, 2012
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var t:Array = new Array(0,0,0,0,0,0,0,0,0);
  2. var tOld:Array = new Array(0,0,0,0,0,0,0,0,0);
  3. var siraXde:Boolean=true;
  4. var pvp=true;
  5. var oyuncuX=true;
  6. var ilkMi=true;
  7. var i:int;
  8. //var xGui1:MovieClip = new xGui();
  9. //for(i=0;i==4;i++)var oGui1:MovieClip = new oGui();
  10. var pt : Array = [
  11.                   new Point(0,0),
  12.                   new Point(100,0),
  13.                   new Point(200,0),
  14.                   new Point(0,100),
  15.                   new Point(100,100),
  16.                   new Point(200,100),
  17.                   new Point(0,200),
  18.                   new Point(100,200),
  19.                   new Point(200,200)
  20.                   ];
  21.  
  22. EventAparati();
  23. reset();
  24.  
  25.  
  26.  
  27. stage.addEventListener(Event.ENTER_FRAME, loop);
  28. function loop(e:Event):void{
  29.    
  30. }
  31.  
  32. function tikla(num):void{
  33.     if(t[num]==0){
  34.         if(siraXde){
  35.             var xGui1:MovieClip = new xGui();
  36.             xGui1.x =pt[num].x;
  37.             xGui1.y = pt[num].y;
  38.             xGui1.gotoAndStop(KarisikVer(1,12));
  39.             stage.addChild(xGui1);
  40.             parent.setChildIndex(xGui1,0)
  41.  
  42.             t[num]=1;
  43.             kontrol();
  44.         }
  45.         if(!siraXde){
  46.             if(pvp){
  47.                 var oGui1:MovieClip = new oGui();
  48.                 oGui1.x =pt[num].x;
  49.                 oGui1.y = pt[num].y;
  50.                 oGui1.gotoAndStop(KarisikVer(1,10));
  51.                 stage.addChild(oGui1);
  52.                 parent.setChildIndex(oGui1,0);
  53.                 t[num]=2;
  54.                 kontrol();
  55.             }
  56.         }
  57.         siraXde=!siraXde;
  58.     }
  59. }
  60. // 0 1 2
  61. // 3 4 5
  62. // 6 7 8
  63. function kontrol():void{
  64.     if(t[0]!=0&&(t[0]==t[1]&&t[1]==t[2]))kazandir(t[0],1)
  65.     else if(t[3]!=0&&(t[3]==t[4]&&t[4]==t[5]))kazandir(t[3],2)
  66.     else if(t[6]!=0&&(t[6]==t[7]&&t[7]==t[8]))kazandir(t[6],3)
  67.     else if(t[0]!=0&&(t[0]==t[3]&&t[3]==t[6]))kazandir(t[0],4)
  68.     else if(t[1]!=0&&(t[1]==t[4]&&t[4]==t[7]))kazandir(t[1],5)
  69.     else if(t[2]!=0&&(t[2]==t[5]&&t[5]==t[8]))kazandir(t[2],6)
  70.     else if(t[0]!=0&&(t[0]==t[4]&&t[4]==t[8]))kazandir(t[0],7)
  71.     else if(t[2]!=0&&(t[2]==t[4]&&t[4]==t[6]))kazandir(t[2],8)
  72. }
  73.  
  74. function kazandir(kim:int,cizgi:int):void{
  75.     cizgiCek(cizgi);
  76.     if(kim==1)xKazandimc.visible=true;
  77.     else if(kim==2)oKazandimc.visible=true;
  78.     tekrarButon.visible=true;
  79.     tekrarButon.addEventListener(MouseEvent.CLICK, tekrarButonf);
  80.     function tekrarButonf(e:MouseEvent):void {reset();}
  81. }
  82. function reset():void{
  83.     c1.visible=false;
  84.     c2.visible=false;
  85.     c3.visible=false;
  86.     c4.visible=false;
  87.     c5.visible=false;
  88.     c6.visible=false;
  89.     c7.visible=false;
  90.     c8.visible=false;
  91.     xKazandimc.visible=false;
  92.     oKazandimc.visible=false;
  93.     tekrarButon.visible=false;
  94.     t=tOld;
  95.     siraXde=true;
  96.     pvp=true;
  97.     oyuncuX=true;
  98.     if(!ilkMi){
  99.     stage.removeChild(xGui1);
  100.     stage.removeChild(oGui1);
  101.     }
  102.     ilkMi=false;
  103. }
  104.  
  105. function cizgiCek(cizgi:int):void{
  106.     switch (cizgi){
  107.     case 1:
  108.     c1.visible=true;
  109.     break;
  110.     case 2:
  111.     c2.visible=true;
  112.     break;
  113.     case 3:
  114.     c3.visible=true;
  115.     break;
  116.     case 4:
  117.     c4.visible=true;
  118.     break;
  119.     case 5:
  120.     c5.visible=true;
  121.     break;
  122.     case 6:
  123.     c6.visible=true;
  124.     break;
  125.     case 7:
  126.     c7.visible=true;
  127.     break;
  128.     case 8:
  129.     c8.visible=true;
  130.     break;
  131.     }
  132. }
  133.  
  134. function KarisikVer(minNum:Number, maxNum:Number):Number{
  135.     return (Math.floor(Math.random() * (maxNum - minNum + 1)) + minNum);
  136. }
  137.  
  138. function EventAparati():void{
  139.     but0.addEventListener(MouseEvent.CLICK, but0f);
  140.     but1.addEventListener(MouseEvent.CLICK, but1f);
  141.     but2.addEventListener(MouseEvent.CLICK, but2f);
  142.     but3.addEventListener(MouseEvent.CLICK, but3f);
  143.     but4.addEventListener(MouseEvent.CLICK, but4f);
  144.     but5.addEventListener(MouseEvent.CLICK, but5f);
  145.     but6.addEventListener(MouseEvent.CLICK, but6f);
  146.     but7.addEventListener(MouseEvent.CLICK, but7f);
  147.     but8.addEventListener(MouseEvent.CLICK, but8f);
  148.     function but0f(evtObj:MouseEvent):void{tikla(0);}
  149.     function but1f(evtObj:MouseEvent):void{tikla(1);}
  150.     function but2f(evtObj:MouseEvent):void{tikla(2);}
  151.     function but3f(evtObj:MouseEvent):void{tikla(3);}
  152.     function but4f(evtObj:MouseEvent):void{tikla(4);}
  153.     function but5f(evtObj:MouseEvent):void{tikla(5);}
  154.     function but6f(evtObj:MouseEvent):void{tikla(6);}
  155.     function but7f(evtObj:MouseEvent):void{tikla(7);}
  156.     function but8f(evtObj:MouseEvent):void{tikla(8);}
  157.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement