-
-
Save taf2/1195667 to your computer and use it in GitHub Desktop.
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
// Production steps of ECMA-262, Edition 5, 15.4.4.18 | |
// Reference: http://es5.github.com/#x15.4.4.18 | |
if (!Array.prototype.forEach) { | |
Array.prototype.forEach = function( callback, thisArg ) { | |
var T, k; | |
if ( this == null ) { | |
throw new TypeError( " this is null or not defined" ); | |
} | |
var O = Object(this); | |
var len = O.length >>> 0; | |
if ( {}.toString.call(callback) != "[object Function]" ) { | |
throw new TypeError( callback + " is not a function" ); | |
} | |
if ( thisArg ) { T = thisArg; } | |
k = 0; | |
while( k < len ) { | |
var kValue; | |
if ( k in O ) { | |
kValue = O[Pk]; | |
callback.call( T, kValue, k, O ); | |
} | |
k++; | |
} | |
}; | |
} |
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(event) { | |
var game_piece, _i, _j, _k, _l, _len, _len2, _len3, _len4, _len5, _len6, _m, _n; | |
switch (event.keyCode) { | |
case 37: | |
game_pieces.forEach(function(game_piece) { game_piece.pan_left() }); | |
break; | |
case 38: | |
game_pieces.forEach(function(game_piece) { game_piece.pan_up() }); | |
break; | |
case 39: | |
game_pieces.forEach(function(game_piece) { game_piece.pan_right() }); | |
break; | |
case 40: | |
game_pieces.forEach(function(game_piece) { game_piece.pan_down() }); | |
break; | |
case 189: | |
game_pieces.forEach(function(game_piece) { game_piece.zoom_out() }); | |
break; | |
case 187: | |
game_pieces.forEach(function(game_piece) { game_piece.zoom_in() }); | |
} | |
return the_screen.refresh(game_pieces); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment