Created
December 26, 2019 22:54
-
-
Save kahilkubilay/863916040260883460705dc2961245b1 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
document.onkeydown = function(e){ | |
switch(e.keyCode){ | |
// sol çubuk | |
case 87: | |
stickLeft.style.top = pxAdd(parseInt(stickLeft.style.top) - 30); | |
break; | |
case 83: | |
stickLeft.style.top = pxAdd(parseInt(stickLeft.style.top) + 30); | |
// sağ çubuk | |
case 38: | |
stickRight.style.top = pxAdd(parseInt(stickRight.style.top) - 30) | |
break; | |
case 40: | |
stickRight.style.top = pxAdd(parseInt(stickRight.style.top) + 30); | |
break;} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment