Quellcode durchsuchen

Refactoring: move function to tools.js

Fabrice Ecaille vor 12 Jahren
Ursprung
Commit
9500c64e20
2 geänderte Dateien mit 14 neuen und 12 gelöschten Zeilen
  1. 0 12
      js/spaceinvaders-utils.js
  2. 14 0
      js/tools.js

+ 0 - 12
js/spaceinvaders-utils.js

@@ -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;
-}

+ 14 - 0
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;
+}