Advertisement
Guest User

Untitled

a guest
Apr 27th, 2015
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.49 KB | None | 0 0
  1.     protected boolean isValidPos(Vector pos) throws OutOfBoundsException {
  2.  
  3.         if (getWorld() == null) {
  4.             if (pos.getElemx() >= 0 && pos.getElemy() >= 0){
  5.                 return true;
  6.             } else{
  7.                 throw new OutOfBoundsException(new Vector(0,0));
  8.             }
  9.         }else if ((pos.getElemx() >= 0) && (pos.getElemy() >= 0)
  10.                 && pos.getElemx() < this.getWorld().getWorldSizeInPixels()[0]
  11.                         && pos.getElemy() < this.getWorld().getWorldSizeInPixels()[1]){
  12.             return true;
  13.         }else{
  14.             return false;
  15.         }
  16.  
  17.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement