daily pastebin goal
71%
SHARE
TWEET

Untitled

a guest Nov 19th, 2018 89 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import flash.events.MouseEvent;
  2. import flash.events.KeyboardEvent;
  3.  
  4. btnStart.addEventListener(MouseEvent.CLICK, spill);
  5.  
  6. mcPuck.visible = false
  7.  
  8. function spill(evt:MouseEvent)
  9. {
  10.     trace("START");
  11.     btnStart.visible = false
  12.     mcPuck.visible = true
  13.    
  14.    
  15. // PLAYER 1 //
  16. stage.addEventListener(KeyboardEvent.KEY_DOWN, tastLytter);
  17.  
  18. function tastLytter(evt:KeyboardEvent)
  19. {
  20.     var tast:int = evt.keyCode;
  21.     if (tast == Keyboard.W)
  22.     {
  23.         if (mcPlayer1.y >= 28)
  24.         {
  25.            mcPlayer1.y -= 8
  26.         }
  27.     }
  28.     if(tast == Keyboard.S)
  29.     {
  30.         if (mcPlayer1.y <= 365)
  31.         {
  32.             mcPlayer1.y += 8
  33.         }
  34.     }
  35. }
  36.  
  37.  
  38.  
  39.  // PLAYER 2 //
  40. stage.addEventListener(KeyboardEvent.KEY_DOWN, tastLytter2);
  41.  
  42. function tastLytter2(evt:KeyboardEvent)
  43. {
  44.     var tast:int = evt.keyCode;
  45.     if (tast == Keyboard.UP)
  46.     {
  47.         if (mcPlayer2.y >= 27)
  48.         {
  49.            mcPlayer2.y -= 8
  50.         }
  51.     }
  52.     if(tast == Keyboard.DOWN)
  53.     {
  54.         if (mcPlayer2.y <= 365)
  55.         {
  56.             mcPlayer2.y += 8
  57.         }
  58.     }
  59. }
  60.  
  61. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top