mirror of
https://github.com/Febbweiss/sis.git
synced 2026-03-04 14:15:37 +00:00
Refactoring: move function to tools.js
This commit is contained in:
@@ -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
js/tools.js
14
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;
|
||||
}
|
||||
Reference in New Issue
Block a user