From 9500c64e20f20252b8e02b5e535d8d8728b9e954 Mon Sep 17 00:00:00 2001 From: Fabrice Ecaille Date: Thu, 28 Nov 2013 17:58:04 +0100 Subject: [PATCH] Refactoring: move function to tools.js --- js/spaceinvaders-utils.js | 12 ------------ js/tools.js | 14 ++++++++++++++ 2 files changed, 14 insertions(+), 12 deletions(-) delete mode 100644 js/spaceinvaders-utils.js diff --git a/js/spaceinvaders-utils.js b/js/spaceinvaders-utils.js deleted file mode 100644 index 8ef3202..0000000 --- a/js/spaceinvaders-utils.js +++ /dev/null @@ -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; -} diff --git a/js/tools.js b/js/tools.js index 1776d24..68e8763 100644 --- a/js/tools.js +++ b/js/tools.js @@ -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; +} \ No newline at end of file