// Note: comments about which requirements are met will be on top of the line of code that meets the requirement
// This is a new class created in the Spring Semester, so #1-18 will not be included in the comments for this class.
public class Enemy extends GameCharacter { // #21 - implementing inheritance heirarchy with student-designed classes
public Enemy() { // zero arg
super();
}
@Override // overrides method of superclass
public String getDirection() { // return position in the form of a String called direction
// #20 - using method from different class/interface
String direction = super.getDirection();
// #5 - switch statement
switch (direction) { // set direction to a different string depending on the position of the character
case "Middle":
direction = super.getName() + " is in the middle of the map.";
break;
case "Left":
direction = super.getName() + " is " + super.getPosition() + " units to the Left.";
break;
case "Right":
direction = super.getName() + " is " + Math.abs(super.getPosition()) + " units to the right.";
break;
}
return direction;
}
} // end class