jplay
Class Collision

java.lang.Object
  extended by jplay.Collision

public class Collision
extends java.lang.Object

Class used to know whether two GameObjects collided.


Constructor Summary
Collision()
           
 
Method Summary
static boolean collided(GameObject obj1, GameObject obj2)
          Static method used to know whether two GameObjects are touching each other.
static boolean collided(java.awt.Point min1, java.awt.Point max1, java.awt.Point min2, java.awt.Point max2)
          Method used to know whether two areas on the screen are touching each other.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Collision

public Collision()
Method Detail

collided

public static boolean collided(java.awt.Point min1,
                               java.awt.Point max1,
                               java.awt.Point min2,
                               java.awt.Point max2)
Method used to know whether two areas on the screen are touching each other.

Parameters:
min1 - point of the top left of the first area.
max1 - point from under of the right of the first image.
min2 - point of the top left of the second area.
max3 - point from under of the right of the second image.
Returns:
boolean - return true if they are touching each other, false otherwise.

collided

public static boolean collided(GameObject obj1,
                               GameObject obj2)
Static method used to know whether two GameObjects are touching each other.

Parameters:
obj1 - origin GameObject
obj2 - target GameObject
Returns:
boolean - return true when they are touching each other, false otherwise.