Package com.hobbitsadventure.model

Examples of com.hobbitsadventure.model.TileClass


    String rowStr;
    while ((rowStr = br.readLine()) != null) {
      int numCols = rowStr.length();
      RealmCell[] row = new RealmCell[numCols];
      for (int j = 0; j < numCols; j++) {
        TileClass tileClass = null;
        Thing thing = null;
        int heightNoise = 0;
       
        char ch = rowStr.charAt(j);
        switch (ch) {
        case '.':
          tileClass = TileClasses.BEACH;
          heightNoise = random.nextInt(2);
          break;
        case '@':
          tileClass = TileClasses.FLOOR_STONE;
          thing = Things.BLUE_GEM;
          break;
        case '$':
          tileClass = TileClasses.FLOOR_STONE;
          thing = Things.CHEST;
          break;
        case '%':
          tileClass = TileClasses.FLOOR_STONE;
          thing = Things.CHEST_OPEN;
          break;
        case ':':
          tileClass = TileClasses.GRASS;
          thing = Things.BRUSH;
          heightNoise = random.nextInt(2);
          break;
        case '#':
          tileClass = TileClasses.WATER;
          thing = Things.DOCK;
          break;
        case '[':
          tileClass = TileClasses.FLOOR_STONE;
          thing = Things.DOOR_CLOSED;
          break;
        case '`':
          tileClass = TileClasses.FLOOR_STONE;
          break;
        case '\'':
          tileClass = TileClasses.FLOOR_WOOD;
          break;
        case '!':
          tileClass = TileClasses.GRASS;
          thing = Things.TREE_TALL;
          heightNoise = random.nextInt(2);
          break;
        case ',':
          tileClass = TileClasses.GRASS;
          heightNoise = random.nextInt(2);
          break;
        case '^':
          tileClass = TileClasses.HILL;
          heightNoise = random.nextInt(2);
          break;
        case 'A':
          tileClass = TileClasses.GRASS;
          thing = Things.ROCK;
          heightNoise = random.nextInt(2);
          break;
        case '_':
          tileClass = TileClasses.ROAD;
          break;
        case 'D':
          tileClass = TileClasses.STAIRS_DOWN;
          break;
        case 'U':
          tileClass = TileClasses.STAIRS_UP;
          break;
        case '*':
          tileClass = TileClasses.GRASS;
          thing = Things.DOOR_CLOSED;
          break;
        case '=':
          // FIXME Need to be able to null this tile instead of rendering two images? Unless the objects are
          // going to be dynamic (e.g. player can build and/or destroy walls).
          tileClass = TileClasses.FLOOR_STONE;
          thing = Things.WALL_TALL;
          break;
        case '~':
          tileClass = TileClasses.WATER;
          break;
        default:
          throw new RuntimeException("Illegal map character: " + ch)
        }
       
        RealmCell cell = new RealmCell();
        cell.setTile(new Tile(tileClass, tileClass.getYOffset() + heightNoise));
        cell.setThing(thing);
        row[j] = cell;
      }
     
      rowList.add(row);
View Full Code Here

TOP

Related Classes of com.hobbitsadventure.model.TileClass

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.