/** * 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; }
/** * 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; }
/** * Checks if the location is in bounds * * @return boolean - is the character in bounds */ public boolean inBounds() { return bounds.inBounds(x, y); }