コード例 #1
0
 /** Moves the player south by decreasing the y position by 1 */
 public void moveSouth(World w) {
   if (yPos == 7) {
     Sys.print("You are at the edge of the map, you cannot move further south!");
   } else {
     yPos++;
     updatePosition(w);
     Sys.print("You have moved south");
     Sys.print("There is " + tPos.getBiome().getFeatures() + " around");
     if (!(tPos.getMob() == null)) {
       Sys.print("There are also " + tPos.getMob().getName() + " here");
     }
   }
 }
コード例 #2
0
 /** Moves the player west by increasing the y position by 1 */
 public void moveWest(World w) {
   if (xPos == 0) {
     Sys.print("You are at the edge of the map, you cannot move further west!");
   } else {
     xPos--;
     updatePosition(w);
     Sys.print("You have moved west");
     Sys.print("There is " + tPos.getBiome().getFeatures() + " around");
     if (!(tPos.getMob() == null)) {
       Sys.print("There are also " + tPos.getMob().getName() + " here");
     }
   }
 }
コード例 #3
0
 /**
  * Returns the current biome the player is located in
  *
  * @return Biome
  */
 public Biome getCurrentBiome() {
   return tPos.getBiome();
 }