Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var t:Array = new Array(0,0,0,0,0,0,0,0,0);
- var tOld:Array = new Array(0,0,0,0,0,0,0,0,0);
- var siraXde:Boolean=true;
- var pvp=true;
- var oyuncuX=true;
- var ilkMi=true;
- var i:int;
- //var xGui1:MovieClip = new xGui();
- //for(i=0;i==4;i++)var oGui1:MovieClip = new oGui();
- var pt : Array = [
- new Point(0,0),
- new Point(100,0),
- new Point(200,0),
- new Point(0,100),
- new Point(100,100),
- new Point(200,100),
- new Point(0,200),
- new Point(100,200),
- new Point(200,200)
- ];
- EventAparati();
- reset();
- stage.addEventListener(Event.ENTER_FRAME, loop);
- function loop(e:Event):void{
- }
- function tikla(num):void{
- if(t[num]==0){
- if(siraXde){
- var xGui1:MovieClip = new xGui();
- xGui1.x =pt[num].x;
- xGui1.y = pt[num].y;
- xGui1.gotoAndStop(KarisikVer(1,12));
- stage.addChild(xGui1);
- parent.setChildIndex(xGui1,0)
- t[num]=1;
- kontrol();
- }
- if(!siraXde){
- if(pvp){
- var oGui1:MovieClip = new oGui();
- oGui1.x =pt[num].x;
- oGui1.y = pt[num].y;
- oGui1.gotoAndStop(KarisikVer(1,10));
- stage.addChild(oGui1);
- parent.setChildIndex(oGui1,0);
- t[num]=2;
- kontrol();
- }
- }
- siraXde=!siraXde;
- }
- }
- // 0 1 2
- // 3 4 5
- // 6 7 8
- function kontrol():void{
- if(t[0]!=0&&(t[0]==t[1]&&t[1]==t[2]))kazandir(t[0],1)
- else if(t[3]!=0&&(t[3]==t[4]&&t[4]==t[5]))kazandir(t[3],2)
- else if(t[6]!=0&&(t[6]==t[7]&&t[7]==t[8]))kazandir(t[6],3)
- else if(t[0]!=0&&(t[0]==t[3]&&t[3]==t[6]))kazandir(t[0],4)
- else if(t[1]!=0&&(t[1]==t[4]&&t[4]==t[7]))kazandir(t[1],5)
- else if(t[2]!=0&&(t[2]==t[5]&&t[5]==t[8]))kazandir(t[2],6)
- else if(t[0]!=0&&(t[0]==t[4]&&t[4]==t[8]))kazandir(t[0],7)
- else if(t[2]!=0&&(t[2]==t[4]&&t[4]==t[6]))kazandir(t[2],8)
- }
- function kazandir(kim:int,cizgi:int):void{
- cizgiCek(cizgi);
- if(kim==1)xKazandimc.visible=true;
- else if(kim==2)oKazandimc.visible=true;
- tekrarButon.visible=true;
- tekrarButon.addEventListener(MouseEvent.CLICK, tekrarButonf);
- function tekrarButonf(e:MouseEvent):void {reset();}
- }
- function reset():void{
- c1.visible=false;
- c2.visible=false;
- c3.visible=false;
- c4.visible=false;
- c5.visible=false;
- c6.visible=false;
- c7.visible=false;
- c8.visible=false;
- xKazandimc.visible=false;
- oKazandimc.visible=false;
- tekrarButon.visible=false;
- t=tOld;
- siraXde=true;
- pvp=true;
- oyuncuX=true;
- if(!ilkMi){
- stage.removeChild(xGui1);
- stage.removeChild(oGui1);
- }
- ilkMi=false;
- }
- function cizgiCek(cizgi:int):void{
- switch (cizgi){
- case 1:
- c1.visible=true;
- break;
- case 2:
- c2.visible=true;
- break;
- case 3:
- c3.visible=true;
- break;
- case 4:
- c4.visible=true;
- break;
- case 5:
- c5.visible=true;
- break;
- case 6:
- c6.visible=true;
- break;
- case 7:
- c7.visible=true;
- break;
- case 8:
- c8.visible=true;
- break;
- }
- }
- function KarisikVer(minNum:Number, maxNum:Number):Number{
- return (Math.floor(Math.random() * (maxNum - minNum + 1)) + minNum);
- }
- function EventAparati():void{
- but0.addEventListener(MouseEvent.CLICK, but0f);
- but1.addEventListener(MouseEvent.CLICK, but1f);
- but2.addEventListener(MouseEvent.CLICK, but2f);
- but3.addEventListener(MouseEvent.CLICK, but3f);
- but4.addEventListener(MouseEvent.CLICK, but4f);
- but5.addEventListener(MouseEvent.CLICK, but5f);
- but6.addEventListener(MouseEvent.CLICK, but6f);
- but7.addEventListener(MouseEvent.CLICK, but7f);
- but8.addEventListener(MouseEvent.CLICK, but8f);
- function but0f(evtObj:MouseEvent):void{tikla(0);}
- function but1f(evtObj:MouseEvent):void{tikla(1);}
- function but2f(evtObj:MouseEvent):void{tikla(2);}
- function but3f(evtObj:MouseEvent):void{tikla(3);}
- function but4f(evtObj:MouseEvent):void{tikla(4);}
- function but5f(evtObj:MouseEvent):void{tikla(5);}
- function but6f(evtObj:MouseEvent):void{tikla(6);}
- function but7f(evtObj:MouseEvent):void{tikla(7);}
- function but8f(evtObj:MouseEvent):void{tikla(8);}
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement