Implement hit object stacking algorithm.

This commit is contained in:
Pavel Kolchev
2015-03-28 15:11:43 +03:00
parent 16ec6c5e23
commit fbe87559c9
8 changed files with 207 additions and 26 deletions

View File

@@ -250,6 +250,20 @@ public class Utils {
return val;
}
/**
*
* @param x1 The x-component of the first point
* @param y1 The y-component of the first point
* @param x2 The x-component of the second point
* @param y2 The y-component of the second point
* @return Euclidean distance between points (x1,y1) and (x2,y2)
*/
public static float distance(float x1, float y1, float x2, float y2) {
float v1 = Math.abs(x1 - x2);
float v2 = Math.abs(y1 - y2);
return (float) Math.sqrt((v1 * v1) + (v2 * v2));
}
/**
* Returns true if a game input key is pressed (mouse/keyboard left/right).
* @return true if pressed