SHARE
TWEET

Untitled

a guest Dec 14th, 2019 79 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. private boolean intersect(GameObject o1, GameObject o2) {
  2.         //return (o1.getY()+o1.getHeight()==o2.getY()&&o1.getX()==o2.getX());
  3.     //return (Math.abs((o1.getX() + o1.getWidth() / 2) - (o2.getX() + o2.getWidth() / 2)) <= o1.getWidth())
  4.             //  && (Math.abs((o1.getY() + o1.getHeight() / 2) - (o2.getY() + o2.getHeight() / 2)) <= o1.getHeight());
  5.         if(((( o1.getX()<=o2.getX() )&& (o1.getX()+o1.getWidth()<=o2.getX()+o2.getWidth()))||(( o1.getX()>=o2.getX() )&& (o1.getX()+o1.getWidth()>=o2.getX()+o2.getWidth())))
  6.                 && (o2.getY()+o2.getHeight()==o1.getY() ) ) {
  7.             /*System.out.println("o1.getX()"+" "+o1.getX());
  8.             System.out.println("o2.getX()"+" "+o2.getX());
  9.             System.out.println("o2.getX()+o2.getWidth()"+" "+o2.getX()+o2.getWidth());
  10.             System.out.println("o2.getY()+o2.getHeight()"+" "+o2.getY()+o2.getHeight());
  11.             System.out.println("o1.getY() "+o1.getY());
  12.             System.out.println("true");*/
  13.             return true;
  14.         }
  15.         else {
  16.            
  17.             /*System.out.println("o1.getX()"+" "+o1.getX());
  18.             System.out.println("o2.getX()"+" "+o2.getX());
  19.             System.out.println("o2.getX()+o2.getWidth()"+" "+o2.getX()+o2.getWidth());
  20.             System.out.println("o2.getY()+o2.getHeight()"+" "+o2.getY()+o2.getHeight());
  21.             System.out.println("o1.getY() "+o1.getY());
  22.             System.out.println("false");
  23.             //System.out.println();*/
  24.             return false;
  25.         }
  26.        
  27.        
  28.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top