Implement hit object stacking algorithm.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user