Skip to content

Instantly share code, notes, and snippets.

@kahilkubilay
Created December 26, 2019 22:52
Show Gist options
  • Save kahilkubilay/0d4d5ab5740db007c00e2a80b2f6e569 to your computer and use it in GitHub Desktop.
Save kahilkubilay/0d4d5ab5740db007c00e2a80b2f6e569 to your computer and use it in GitHub Desktop.
Javascript İle Oyun Yapımı: Nesnelerin Kontrolü - Çubuk
document.onkeydown = function(e){
switch(e.keyCode){
// sol çubuk
case 87:
console.log('w tusuna basildi');
break;
case 83:
console.log('s tusuna basildi');
// sağ çubuk
case 38:
console.log('yukarı ok tuşuna basıldı');
break;
case 40:
console.log('aşağı ok tuşuna basıldı');
break;}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment