예제 #1
0
 /**
  * Adds deltaX to the X coordinate if the new coordinate is in bounds.
  *
  * @return The direction the Character should be facing
  */
 public int setX(float deltax) {
   int direction = 3;
   if (deltax < 0) {
     direction = 9;
   }
   if (bounds.inBounds(x + deltax, y)) {
     x += deltax;
   }
   return direction;
 }
예제 #2
0
  /**
   * Adds deltaY to the Y coordinate if the new coordinate is in bounds.
   *
   * @return The direction the Character should be facing
   */
  public int setY(float deltay) {
    int direction = 6;
    if (deltay < 0) {
      direction = 12;
    }

    if (bounds.inBounds(x, y + deltay)) {
      y += deltay;
    }
    return direction;
  }
예제 #3
0
 /**
  * Checks if the location is in bounds
  *
  * @return boolean - is the character in bounds
  */
 public boolean inBounds() {
   return bounds.inBounds(x, y);
 }