removed wasd from tetris

This commit is contained in:
Boof 2022-10-21 12:12:26 +02:00 committed by GitHub
parent d783c3b9c7
commit 6d750204f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 0 additions and 40 deletions

View File

@ -11,6 +11,5 @@
<script src='js/tetris.js'></script>
<script src='js/controller.js'></script>
<script src='js/render.js'></script>
<script src='js/controller2.js'></script>
</body>
</html>

View File

@ -1,12 +0,0 @@
document.body.onkeydown = function( e ) {
var keys2 = {
65: 'left2',
68: 'right2',
83: 'down2',
87: 'rotate2',
};
if ( typeof keys2[ e.keyCode ] != 'undefined' ) {
keyPress2( keys2[ e.keyCode ] );
render();
}
};

View File

@ -158,33 +158,6 @@ function keyPress( key ) {
break;
}
}
function keyPress2( key ) {
switch ( key ) {
case 'left2':
if ( valid( -1 ) ) {
--currentX;
}
break;
case 'right2':
if ( valid( 1 ) ) {
++currentX;
}
break;
case 'down2':
if ( valid( 0, 1 ) ) {
++currentY;
}
break;
case 'rotate2':
var rotated = rotate( current );
if ( valid( 0, 0, rotated ) ) {
current = rotated;
}
tick();
break;
}
}
// checks if the resulting position of current shape will be feasible
function valid( offsetX, offsetY, newCurrent ) {