Refactoring: move function to tools.js

This commit is contained in:
Fabrice Ecaille
2013-11-28 17:58:04 +01:00
parent 316c712b41
commit 9500c64e20
2 changed files with 14 additions and 12 deletions

View File

@@ -1,12 +0,0 @@
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;
}

View File

@@ -67,3 +67,17 @@ function angle(vector1, vector2) {
return sign * alpha;
}
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;
}