Advertisement
Guest User

Untitled

a guest
Mar 26th, 2015
258
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.40 KB | None | 0 0
  1. //Constructor for railcars
  2.     public RailCar(int x, int y, int n) {
  3.         railCartNumber=n;
  4.         railCartXPos=x;
  5.         railCartYPos=y;
  6.         box= new Rectangle(BODY_WIDTH, BODY_HEIGHT, x, y);
  7.     }
  8.  
  9. //check method
  10.     public boolean overlapsCheck(RailCar other){
  11.        
  12.        
  13.         if (box.intersects(this.box)) {
  14.             System.out.println("I say it overlaps!");
  15.             return true;
  16.         }
  17.         return false;
  18.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement