added wasd controls to tetris

This commit is contained in:
Boof 2022-10-21 11:13:58 +02:00 committed by GitHub
parent 247b0ef90b
commit b33c3b60cd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View File

@ -6,6 +6,12 @@ document.body.onkeydown = function( e ) {
38: 'rotate',
32: 'drop'
};
var keys = {
68: 'left',
65: 'right',
83: 'down',
87: 'rotate',
};
if ( typeof keys[ e.keyCode ] != 'undefined' ) {
keyPress( keys[ e.keyCode ] );
render();

View File

@ -15,4 +15,4 @@
<p><a href="/3D CHESS">3D Chess</a></p>
<p><a href="/Pixel dodge">Pixel dodge</a></p>
<p><a href="/Tic Tac Toe">Tic Tac Toe</a></p>
<p><a href="/Getting over it only html/">Getting over it: Scratch edition</a></p>
<p><a href="/Getting over it only html/">Getting over it: Scratch edition</a></p>