This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | // ball elementi üzerinde işlemler | |
| var ball = document.getElementById('ball'); | |
| ball.style.top = window.innerHeight/2 + 'px'; | |
| ball.style.left = (window.innerWidth/2) + (16/2) + 'px'; | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | // #ball alacağı değerler | |
| ball.style.top = pxAdd(parseInt(ball.style.top) + 2); | |
| ball.style.left = pxAdd(parseInt(ball.style.left) + 2); | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | // oyunun sürekli devam etmesi için gerekli yapı | |
| function gameLoop(){ | |
| // topun alacağı değerler | |
| ball.style.top = pxAdd(parseInt(ball.style.top) + 2); | |
| ball.style.left = pxAdd(parseInt(ball.style.left) + 2); | |
| } | |
| setInterval(gameLoop, 20); | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | function gameLoop(){ | |
| //topun alacağı değerler | |
| ball.style.top = pxAdd(parseInt(ball.style.top) + ballTop); | |
| ball.style.left = pxAdd(parseInt(ball.style.left) + ballLeft); | |
| } | |
| setInterval(gameLoop, gameSpeed); | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | // top üst ve alt bloklara çarparsa, X ekseninde geri seksin | |
| if(parseInt(ball.style.top) <= 0 || parseInt(ball.style.top) + 16 >= window.height){ | |
| ballTop *= -1; | |
| } | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | // top sağ ve sol çubuklara çarparsa, Y ekseninde geri seksin | |
| if(parseInt(ball.style.left) <= 0 + 16 && parseInt(ball.style.top) >= parseInt(stickLeft.style.top) && parseInt(ball.style.top) <= parseInt(stickLeft.style.top) + 85){ | |
| ballLeft *= -1; | |
| }else if(parseInt(ball.style.left) + 16 >= window.innerWidth - 12 && parseInt(ball.style.top) >= parseInt(stickRight.style.top) && parseInt(ball.style.top) <= parseInt(stickRight.style.top) + 85){ | |
| ballLeft *= -1; | |
| } | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | // stick değişkenleri | |
| var stickLeft = document.getElementById('stickLeft'); | |
| var stickRight = document.getElementById('stickRight'); | |
| // ball değişkenleri | |
| var ball = document.getElementById('ball'); | |
| stickLeft.style.top = window.innerHeight/2 + 'px'; | |
| stickRight.style.top = window.innerHeight/2 + 'px'; | |
| ball.style.top = window.innerHeight/2 + 'px'; | |
| ball.style.left = (window.innerWidth/2) - (16/2) + 'px'; | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | if(parseInt(ball.style.left) <= 0){ | |
| scoreRight++; | |
| document.getElementById('scoreRight').innerHTML = scoreRight; | |
| } | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | if(parseInt(ball.style.left) + 16 >= window.innerWidth){ | |
| scoreLeft++; | |
| document.getElementById('scoreLeft').innerHTML = scoreLeft; | |
| } | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | //gameLoop function.... | |
| if(parseInt(ball.style.left) <= 0){ | |
| scoreRight++; | |
| document.getElementById('scoreRight').innerHTML = scoreRight; | |
| gameChain(); | |
| } | |
| if(parseInt(ball.style.left) + 16 >= window.innerWidth){ | |
| scoreLeft++; | |
| document.getElementById('scoreLeft').innerHTML = scoreLeft; |