Created
          December 26, 2019 22:55 
        
      - 
      
- 
        Save kahilkubilay/3a2f87018f1031b995725b34e0626894 to your computer and use it in GitHub Desktop. 
     Javascript İle Oyun Yapımı: Nesnelerin Kontrolü - Çubuk 
  
        
  
    
      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
    
  
  
    
  | switch(e.keyCode){ | |
| // sol çubuk | |
| case 87: | |
| if(parseInt(stickLeft.style.top) <= 0){ | |
| stickLeft.style.top = stickLeft.style.top; | |
| }else{ | |
| stickLeft.style.top = pxAdd(parseInt(stickLeft.style.top) - 30); | |
| } | |
| break; | |
| case 83: | |
| if(parseInt(stickLeft.style.top) + 85 >= window.innerHeight){ | |
| stickLeft.style.top = stickLeft.style.top; | |
| }else{ | |
| stickLeft.style.top = pxAdd(parseInt(stickLeft.style.top) + 30); | |
| } | |
| break; | |
| case 38: | |
| if(parseInt(stickRight.style.top) <= 0){ | |
| stickRight.style.top = stickRight.style.top; | |
| }else{ | |
| stickRight.style.top = pxAdd(parseInt(stickRight.style.top) - 30); | |
| } | |
| break; | |
| case 40: | |
| if(parseInt(stickRight.style.top) + 85 >= window.innerHeight){ | |
| stickRight.style.top = stickRight.style.top; | |
| }else{ | |
| stickRight.style.top = pxAdd(parseInt(stickRight.style.top) + 30); | |
| } | |
| break; | |
| default: | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment