mirror of
https://github.com/hexahigh/games.git
synced 2025-12-11 20:15:38 +01:00
added wasd controls to tetris
This commit is contained in:
parent
247b0ef90b
commit
b33c3b60cd
@ -6,6 +6,12 @@ document.body.onkeydown = function( e ) {
|
|||||||
38: 'rotate',
|
38: 'rotate',
|
||||||
32: 'drop'
|
32: 'drop'
|
||||||
};
|
};
|
||||||
|
var keys = {
|
||||||
|
68: 'left',
|
||||||
|
65: 'right',
|
||||||
|
83: 'down',
|
||||||
|
87: 'rotate',
|
||||||
|
};
|
||||||
if ( typeof keys[ e.keyCode ] != 'undefined' ) {
|
if ( typeof keys[ e.keyCode ] != 'undefined' ) {
|
||||||
keyPress( keys[ e.keyCode ] );
|
keyPress( keys[ e.keyCode ] );
|
||||||
render();
|
render();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user