Feature: add 2 kinds of aliens

Refactoring: better way to manage aliens
Refatcoring: creating models and animations folders to manage independent files
This commit is contained in:
Fabrice Ecaille
2013-11-28 17:52:19 +01:00
parent cc470ba791
commit dbef43e61b
14 changed files with 765 additions and 266 deletions

12
js/spaceinvaders-utils.js Normal file
View File

@@ -0,0 +1,12 @@
function getAliensMidHeight() {
var higherAlien = Math.max.apply( null,
$(".alien").map(function() {
return $(this).y();
}).get() ),
lowerAlien = Math.min.apply( null,
$(".alien").map(function() {
return $(this).y();
}).get() );
return (higherAlien + lowerAlien) / 2;
}