Guest User

Untitled

a guest
Feb 20th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import flash.events.Event;
  2.  
  3. paper.addEventListener(MouseEvent.CLICK, Paper);
  4.  
  5. function Paper(e:Event):void
  6. {
  7.     you.text = "You Chose Paper!";
  8.     yourChoise = 0;
  9.     randomComputer();
  10.     choises();
  11. }
  12.  
  13.  
  14. btn_rock.addEventListener(MouseEvent.CLICK, Rock);
  15.  
  16. function Rock(e:Event):void
  17. {
  18.     you.text = "You Chose  Rock!";
  19.     yourChoise = 1;
  20.     randomComputer();
  21.     choises();
  22. }
  23.  
  24. btn_scissor.addEventListener(MouseEvent.CLICK, Scissor);
  25.  
  26.  
  27.  
  28. function Scissor(e:Event):void
  29. {
  30.     you.text = "You Chose Scissor!";
  31.     yourChoise = 2;
  32.     randomComputer();
  33.     choises();
  34. }
  35.  
  36. var namn:Array = new Array(3);
  37. namn[0] = "Paper";
  38. namn[1] = "Rock";
  39. namn[2] = "Scissor";
  40.  
  41. var yourChoise:int = 0;
  42.  
  43. var computerChoise:int = 0;
  44.  
  45. var myScore:int;
  46.  
  47. var computerScore:int;
  48.  
  49. function randomComputer():void
  50. {
  51.     computerChoise = Math.random() * namn.length;
  52.  
  53. }
  54.  
  55. function choises():void
  56. {
  57.  
  58.     if (yourChoise == computerChoise)
  59.     {
  60.         result.text = "Tie!";
  61.         computer.text = "Tie!";
  62.         computerChose.text = "Computer Chose Same as You!";
  63.     }
  64.  
  65.     if (yourChoise==0 && computerChoise==1)
  66.     {
  67.         result.text = "You Win!";
  68.         textScore.text = myScore;
  69.         myScore++;
  70.         computer.text = "Computer Lose!";
  71.         computerChose.text = "Computer Chose Rock!";
  72.     }
  73.  
  74.     if (yourChoise==1 && computerChoise==0)
  75.     {
  76.         result.text = "You Lose!";
  77.         computer.text = "Computer Win!";
  78.         computerChose.text = "Computer Chose Paper!";
  79.  
  80.     }
  81.  
  82.     if (yourChoise==2 && computerChoise==0)
  83.     {
  84.         result.text = "You Win!";
  85.         computer.text = "Computer Lose!";
  86.         computerChose.text = "Computer Chose Paper!";
  87.  
  88.     }
  89.  
  90.     if (yourChoise==0 && computerChoise==2)
  91.     {
  92.         result.text = "You Lose!";
  93.         computer.text = "Computer Win";
  94.         computerChose.text = "Computer Chose Scissor!";
  95.  
  96.     }
  97.  
  98.  
  99.     if (yourChoise==2 && computerChoise==1)
  100.     {
  101.         result.text = "You Lose!";
  102.         computer.text = "Computer Win!";
  103.         computerChose.text = "Computer Chose Rock!";
  104.  
  105.     }
  106.  
  107.  
  108.     if (yourChoise==1 && computerChoise==2)
  109.     {
  110.         result.text = "You Win!";
  111.         computer.text = "Computer Lose!";
  112.         computerChose.text = "Computer Chose Scissor!";
  113.  
  114.     }
  115. }
Add Comment
Please, Sign In to add comment