Ejemplo n.º 1
0
 private void addWallToBoard(int idx, Location stPos, int len, String dir) {
   // TODO Auto-generated method stub
   Wall aw = new Wall();
   aw.wallIndex = idx;
   Location vertex1 = stPos;
   Location vertex2 = new Location();
   // aw.leftEnd = stPos;
   CardinalDirections cd = CardinalDirections.getCardinalFromString(dir);
   switch (cd) {
     case N:
       vertex2.xloc = vertex1.xloc;
       vertex2.yloc = vertex1.yloc - len;
       break;
     case S:
       vertex2.xloc = vertex1.xloc;
       vertex2.yloc = vertex1.yloc + len;
       break;
     case E:
       vertex2.xloc = vertex1.xloc + len;
       vertex2.yloc = vertex1.yloc;
       break;
     default: // W
       vertex2.xloc = vertex1.xloc - len;
       vertex2.yloc = vertex1.yloc;
       break;
   }
   aw.leftEnd = vertex1;
   aw.rightEnd = vertex2;
   board._walls.add(aw);
 }
Ejemplo n.º 2
0
  public void paint(Graphics g) {
    // update drawing

    for (int i = 0; i < 14; i++)
      for (int j = 0; j < 10; j++) g.drawImage(backgroundImage, 60 * i, 60 * j, this);

    g.drawImage(
        playerImage,
        player.getCenterX(),
        player.getCenterY(),
        player.getCenterX() + 60,
        player.getCenterY() + 60,
        player.getRotation() * 60,
        0,
        player.getRotation() * 60 + 60,
        60,
        this);
    for (Enemy e : enemies) {
      g.drawImage(
          enemyImage,
          e.getCenterX(),
          e.getCenterY(),
          e.getCenterX() + 60,
          e.getCenterY() + 60,
          e.getRotation() * 60,
          0,
          e.getRotation() * 60 + 60,
          60,
          this);
    }
    for (Wall w : walls) {
      g.drawImage(wallImage, w.getCenterX(), w.getCenterY(), this);
    }
  }
Ejemplo n.º 3
0
Archivo: World.java Proyecto: munro/lzr
 public void render() {
   ListIterator<Wall> it;
   Wall w;
   for (it = walls.listIterator(); it.hasNext(); ) {
     w = it.next();
     w.render();
   }
 }
Ejemplo n.º 4
0
 public boolean intersectWithWall() {
   for (Wall w : game.playground().getWalls()) {
     if (w.intersects(this)) {
       return true;
     }
   }
   return false;
 }
Ejemplo n.º 5
0
  public void mousePressed() {
    ArrayList<Agent> agents = env.getAllAgents();
    Agent agent_clicked = null;

    if (win.mousePressed()) return;
    if (!Utilities.isPointInBox(mouseX, mouseY, 0, 0, draw_width, draw_height)) return;

    /*
     * Mouse Modes are as follows:
     * 0 = Click tool - Select agents to see information on them in the top left hand corner
     * 1 = Food tool - Place food where you click
     * 2 = Agent tool - Place agent where you click
     * 3 = Thrust tool - Thrusts the agent clicked on by 2
     * 4 = Wall tool - Place a new wall in the environment
     */

    // coordinates of the mouse within the simulation environment
    int simMouseX = (int) ((float) (mouseX - offsetX) / zoomLevel);
    int simMouseY = (int) ((float) (mouseY - offsetY) / zoomLevel);
    if (!Utilities.isPointInBox(simMouseX, simMouseY, 0, 0, Environment.width, Environment.height))
      return;

    // A wall has been placed -> add to the world
    if (PLACE_MODE) {
      PLACE_MODE = false;
      ArrayList<Wall> walls = env.getAllWalls();
      Wall wl = walls.get(walls.size() - 1);
      wl.addToWorld();
      return;
    }
    switch (mouseMode) {
      case 0:
        agent_clicked = getClickedAgent(agents, simMouseX, simMouseY);
        if (agent_clicked != null) { // agent was clicked so update selected
          selectedAgent = agent_clicked;
        }
        break;

      case 1:
        env.addSeaweed(new Point2D.Double(simMouseX, simMouseY));
        break;

      case 2:
        int heading = (int) Math.floor(Math.random() * 360);
        env.addFish(new Point2D.Double(simMouseX, simMouseY), heading);
        break;
      case 3:
        agent_clicked = getClickedAgent(agents, simMouseX, simMouseY);
        if (agent_clicked != null) { // agent was clicked so update selected
          agent_clicked.thrust(2);
        }
        break;
      case 4:
        env.addWall(
            new Point2D.Double(simMouseX, simMouseY), new Point2D.Double(simMouseX, simMouseY));
        PLACE_MODE = true;
    }
  }
Ejemplo n.º 6
0
 public void checkForHit() {
   if (topWall.getTopBounds().intersects(bird.getBounds())
       || bottomWall.getTopBounds().intersects(bird.getBounds())
       || topWall.getBottomBounds().intersects(bird.getBounds())
       || bottomWall.getBottomBounds().intersects(bird.getBounds())
       || bird.getBounds().intersects(new Rectangle2D.Double(0, 600, 800, 10))) {
     isDead = true;
   }
 }
Ejemplo n.º 7
0
Archivo: World.java Proyecto: munro/lzr
 boolean intersectsWall(Vector2f a, Vector2f b) {
   ListIterator<Wall> it;
   Wall w;
   // int x = 0;
   for (it = walls.listIterator(); it.hasNext(); ) {
     w = it.next();
     // System.out.println("HEY " + (x++));
     if (w.intersectsLine(a, b)) return true;
   }
   return false;
 }
Ejemplo n.º 8
0
  public void mouseMoved() {
    if (PLACE_MODE) {
      int simMouseX = (int) ((float) (mouseX - offsetX) / zoomLevel);
      int simMouseY = (int) ((float) (mouseY - offsetY) / zoomLevel);
      ArrayList<Wall> walls = env.getAllWalls();
      Wall w = walls.get(walls.size() - 1);

      w.getEnd().x = simMouseX;
      w.getEnd().y = simMouseY;
    }
  }
Ejemplo n.º 9
0
 public Materials getMaterials(boolean withRight, boolean withTop) {
   Materials materials = new Materials();
   entities
       .values()
       .stream()
       .forEach(
           (entity) -> {
             materials.put(entity.getMaterials());
           });
   if (withRight) {
     for (int i = 0; i < Constants.FLOORS_LIMIT; i++) {
       Wall wall = map.getTile(this, 1, 0).getVerticalWall(i);
       Wall fence = map.getTile(this, 1, 0).getVerticalFence(i);
       if (wall != null) {
         materials.put(wall.getMaterials());
       }
       if (fence != null) {
         materials.put(fence.getMaterials());
       }
     }
   }
   if (withTop) {
     for (int i = 0; i < Constants.FLOORS_LIMIT; i++) {
       Wall wall = map.getTile(this, 0, 1).getHorizontalWall(i);
       Wall fence = map.getTile(this, 0, 1).getHorizontalFence(i);
       if (wall != null) {
         materials.put(wall.getMaterials());
       }
       if (fence != null) {
         materials.put(fence.getMaterials());
       }
     }
   }
   return materials;
 }
Ejemplo n.º 10
0
 public boolean hitWall(Wall w) {
   if (this.isLive() && this.getRect().intersects(w.getRect())) {
     this.live = false;
     return true;
   }
   return false;
 }
Ejemplo n.º 11
0
 // 碰撞测试判断,是否与墙撞了
 public boolean collidesWithWall(Wall w) {
   if (this.tlive && this.getRect().intersects(w.getRect())) {
     this.stay();
     return true;
   }
   ;
   return false;
 }
Ejemplo n.º 12
0
  public void render(Wall wall) {
    Stroke stroke = graphics.getStroke();
    graphics.setStroke(new BasicStroke(10));
    Vector from = wall.from().add(viewPoint);
    Vector to = wall.to().add(viewPoint);
    graphics.drawLine((int) from.x(), (int) from.y(), (int) to.x(), (int) to.y());
    graphics.setStroke(stroke);

    if (showWallNormals) {
      Vector centre = wall.centre().add(viewPoint);
      Vector normal = wall.normal();
      int x = (int) centre.x();
      int y = (int) centre.y();
      int toX = x + (int) (normal.x() * 10);
      int toY = y + (int) (normal.y() * 10);
      graphics.drawLine(x, y, toX, toY);
    }
  }
Ejemplo n.º 13
0
  @Test
  public void usage() {
    HouseBuilder.Start<Void> houseBuilder = HouseGenerator.create(new HouseHelperImpl());

    Wall wall1 = houseBuilder.addWall().setWidth(120.35).setColor(Color.RED);

    Wall wall2 = houseBuilder.addWall().setColor(Color.BLACK).setWidth(87.45);

    Wall wall3 = houseBuilder.addWall().setColor(Color.BLACK).setWidth(80.25);
    wall3.isWeightBearing(true); // this method isn't on the builder

    AffordableHouse option1 = houseBuilder.constructAffordableHouse();
    ExpensiveHouse option2 = houseBuilder.constructExpensiveHouse();

    System.out.println(getInfo(option1));
    System.out.println();
    System.out.println(getInfo(option2));
  }
Ejemplo n.º 14
0
 @Override
 public void run() {
   // update game and update animations
   while (true) {
     player.update();
     for (Enemy e : enemies) {
       e.update();
     }
     for (Wall w : walls) {
       w.update();
     }
     repaint();
     try {
       Thread.sleep(17);
     } catch (InterruptedException e) {
       e.printStackTrace();
     }
   }
 }
Ejemplo n.º 15
0
 public boolean hitWall(Wall w) {
   if (this.getRec().intersects(w.getRec())) {
     /*this.x = iOldX;
     this.y = iOldY;*/
     tc.missiles.remove(this);
     this.bLive = false;
     return true;
   }
   return false;
 }
Ejemplo n.º 16
0
 @Override
 public void paintComponent(Graphics g) {
   g.setColor(Color.WHITE);
   super.paintComponent(g);
   Graphics2D g2 = (Graphics2D) g;
   if (isDead) {
     g2.setColor(Color.BLACK);
     g2.setFont(new Font("Serif", Font.PLAIN, 30));
     g2.drawString("Game Over!", 300, 300);
     g2.drawString("Your final score was " + score, 250, 330);
     moverTimer.stop();
     scoreTimer.stop();
   } else {
     topWall.paint(g2);
     bottomWall.paint(g2);
     bird.paint(g2);
     g2.setColor(Color.BLACK);
     g2.setFont(new Font("Serif", Font.PLAIN, 20));
     g2.drawString("Score: " + score, 50, 50);
   }
 }
Ejemplo n.º 17
0
  // Deserialises the environment class selected by user
  private void restoreEnvironment() {
    JFileChooser diag = getFileChooser(false);
    if (diag.showOpenDialog(this) != JFileChooser.APPROVE_OPTION) return;

    File file = diag.getSelectedFile();
    if (!file.exists()) {
      System.out.println("Save file does not exist" + file.getAbsolutePath());
      return;
    }

    try {
      FileInputStream input = new FileInputStream(file);
      ObjectInputStream in = new ObjectInputStream(input);
      Environment en = (Environment) in.readObject();
      in.close();
      input.close();

      if (en != null) { // set all parent variables in environment to this class
        env = en;
        env.parent = this;
        env.buildBox2DWorld();

        for (Agent ag : env.getAllAgents()) {
          ag.parent = this;
          ag.world = env.world;
          ag.setupBox2d();
        }

        for (Wall wall : env.getAllWalls()) {
          wall.world = env.world;
          wall.setupBox2d();
        }
      }

      System.out.println("Environment loaded");
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
Ejemplo n.º 18
0
  private void verifyCrashes() {
    borderCrash(ball);

    // CRASHES TO THE SHIPBALL FALLING DOWN
    if ((ball.getYC() + ball.getRadio()) >= ship.sideY1 && ball.getDY() >= 0) {
      ship.shipCrash(ball);
    }
    // CRASHES TO THE WALL  WITH BALL
    boolean cmpSideY2 = (ball.getYC() - ball.getRadio()) <= wall.sideY2 && ball.getDY() <= 0;
    boolean cmpSideY1 = (ball.getYC() + ball.getRadio()) >= wall.sideY1 && ball.getDY() >= 0;
    if (cmpSideY1 || cmpSideY2) {
      wall.blockListCrashes(ball);
    }
  }
Ejemplo n.º 19
0
  public void run() {
    try {
      ball = new Ball(10, 500, 660, -1, -1, Color.white);
      ship = new Ship(500, 685, 120, 30, Color.cyan);

      wall.fillBockList();
      wall.blockListUpdatepoints();
      // sound.soundtrack();

      margin();
      while (true) {
        System.out.println(min);
        // playMusic();
        try {
          // System.out.println("\n");
          // graphDB.fillRect(0,0, width, height);
          graphDB.clearRect(26, 47, getWidth() - 326, getHeight() - 72);

          // CRASHES

          verifyCrashes();
          // borderCrash(ball);
          // ship.shipCrash(ball);
          // wall.blockListCrashes(ball);

          // UPDATE ELEMENTS
          wall.blockListKill(ship);
          ball.wayCalculator();
          wall.boomListUpdate();

          ship.move();
          ship.updateGuns();
          ship.updatePoints(); // save ship points

          // PAINT ELEMENTS
          ship.paintAllGuns(graphDB);
          ship.paintShip(graphDB);
          ball.paintBall(graphDB, ball.getRadio(), ball.getXC(), ball.getYC());
          wall.paintBlockList(graphDB);
          // --wall.painBlockMaze(graphDB);
          // efects
          wall.boomEfect(graphDB);

          repaint();
          sleep(5);
        } catch (InterruptedException ex) {
          System.out.println("there is a error  in the while.....!!!!");
        }
      }
    } catch (Exception e) {
      System.out.println("there is a error!!!!");
    }
  }
Ejemplo n.º 20
0
  @Override
  protected void applyToWaySegment(MapWaySegment line) {

    TagGroup tags = line.getTags();
    if (!tags.containsKey("barrier")) return; // fast exit for common case

    if (Wall.fits(tags)) {
      line.addRepresentation(new Wall(line));
    } else if (CityWall.fits(tags)) {
      line.addRepresentation(new CityWall(line));
    } else if (Hedge.fits(tags)) {
      line.addRepresentation(new Hedge(line));
    } else if (ChainLinkFence.fits(tags)) {
      line.addRepresentation(new ChainLinkFence(line, tags));
    } else if (Fence.fits(tags)) {
      line.addRepresentation(new Fence(line, tags));
    }
  }
Ejemplo n.º 21
0
  private void drawSimulation(PApplet canvas) {
    pushMatrix();
    translate(offsetX, offsetY);
    scale(zoomLevel);

    ArrayList<Agent> agents = env.getAllAgents(); // Returns an arraylist of agents
    ArrayList<Food> food = env.getAllFood(); // Returns an arraylist of all the food on the map
    ArrayList<Wall> walls = env.getAllWalls(); // Returns an arraylist of all walls
    ArrayList<Seaweed> seaweed = env.getAllSeaweed();

    for (int i = 0;
        i < agents.size();
        i++) { // Runs through arraylist of agents, will draw them on the canvas
      Agent ag = agents.get(i);

      // draw the field of view for the agent
      if (selectedAgent == null || !agentFocused || (agentFocused && ag == selectedAgent))
        stroke(128);
      else stroke(128, 100); // , (float) ag.getHealth()*200+55
      noFill();
      double range = ag.getVisionRange() * 2;

      pushMatrix();
      translate(ag.getX(), ag.getY());
      rotate((float) Utilities.toRadians(ag.getViewHeading() - ag.getFOV()));
      line(0, 0, (int) (range / 2), 0);
      popMatrix();

      pushMatrix();
      translate(ag.getX(), ag.getY());
      rotate((float) Utilities.toRadians(ag.getViewHeading() + ag.getFOV()));
      line(0, 0, (int) (range / 2), 0);
      popMatrix();

      arc(
          (float) ag.getX(),
          (float) ag.getY(),
          (float) range,
          (float) range,
          (float) Utilities.toRadians(ag.getViewHeading() - ag.getFOV()),
          (float) Utilities.toRadians(ag.getViewHeading() + ag.getFOV()));

      // draw our circle representation for the agent
      noStroke();
      // if(selectedAgent == null || !agentFocused || (agentFocused && ag == selectedAgent))
      // fill(theme.getColor((ag instanceof Enemy ? Types.SHARK : Types.FISH)));
      // else fill(theme.getColor((ag instanceof Enemy ? Types.SHARK : Types.FISH)), 100); //,
      // (float) ag.getHealth()*200 +55); // Alpha was severly impacting performance of simulation
      if (ag instanceof Enemy) {
        fill(
            ((ag.getSpeciesId() + 1) * 25) % 256,
            ((ag.getSpeciesId() + 1) * 47) % 256,
            ((ag.getSpeciesId() + 1) * 69) % 256,
            (agentFocused && ag == selectedAgent ? 100 : 256));
        pushMatrix();
        translate(ag.getX(), ag.getY());
        rotate((float) Utilities.toRadians(ag.getViewHeading()));
        rect(-10, -10, 20, 20);
        popMatrix();
      } else {
        fill(
            ((ag.getSpeciesId() + 1) * 25) % 256,
            ((ag.getSpeciesId() + 1) * 47) % 256,
            ((ag.getSpeciesId() + 1) * 69) % 256,
            (agentFocused && ag == selectedAgent ? 100 : 256));
        ellipse(ag.getX(), ag.getY(), 20, 20);
      }

      if (agentFocused
          && ag == selectedAgent) { // keep agent on screen if in focused / tracking mode
        int simAgX =
            (int) ((ag.getX() * zoomLevel) + offsetX); // screen coordinates of the selected agent
        int simAgY = (int) ((ag.getY() * zoomLevel) + offsetY);

        if (simAgX < trackingBounds) offsetX += trackingBounds - simAgX;
        else if (simAgX > draw_width - trackingBounds)
          offsetX -= simAgX - draw_width + trackingBounds;

        if (simAgY < trackingBounds) offsetY += trackingBounds - simAgY;
        else if (simAgY > draw_height - trackingBounds)
          offsetY -= simAgY - draw_height + trackingBounds;
      }
    }

    noStroke();
    fill(theme.getColor(Types.FOOD));
    for (int i = 0;
        i < food.size();
        i++) { // Runs through arraylist of food, will draw them on the canvas
      Food fd = food.get(i);
      ellipse(fd.getX(), fd.getY(), 5, 5);
    }

    noStroke();
    fill(201, 23, 134);
    for (int i = 0;
        i < seaweed.size();
        i++) { // Runs through arraylist of food, will draw them on the canvas
      Seaweed fd = seaweed.get(i);
      ellipse(fd.getX(), fd.getY(), 5, 5);
    }

    stroke(theme.getColor(Types.WALL));
    noFill();
    for (Wall wl : walls) { // Runs through arraylist of walls, will draw them on the canvas
      switch (wl.getWallType()) {
        case Collision.TYPE_WALL_AGENT:
          stroke(theme.getColor(Types.FISH));
          break;
        case Collision.TYPE_WALL_ENEMY:
          stroke(theme.getColor(Types.SHARK));
          break;
        default:
          stroke(theme.getColor(Types.WALL));
      }

      line(
          (float) wl.getStart().x,
          (float) wl.getStart().y,
          (float) wl.getEnd().x,
          (float) wl.getEnd().y);
    }

    popMatrix();

    fill(0);
    // rect(draw_width - 50, 0, 250, draw_height);
  }
Ejemplo n.º 22
0
 /** add a control point */
 public void addPoint(Point p) {
   if (pts2d.size() < 4) {
     super.addPoint(p);
   }
 }
Ejemplo n.º 23
0
  private void renderEntities(GL2 g) {
    for (Entry<EntityData, TileEntity> e : entities.entrySet()) {
      EntityData key = e.getKey();
      final int floor = key.getFloor();
      float colorMod = 1;
      if (Globals.upCamera) {
        switch (Globals.floor - floor) {
          case 0:
            colorMod = 1;
            break;
          case 1:
            colorMod = 0.6f;
            break;
          case 2:
            colorMod = 0.25f;
            break;
          default:
            continue;
        }
      }
      TileEntity entity = e.getValue();
      g.glPushMatrix();
      switch (key.getType()) {
        case FLOORROOF:
          g.glTranslatef(4, 0, 3 * floor + getFloorHeight() / Constants.HEIGHT_MOD);
          g.glColor3f(colorMod, colorMod, colorMod);
          entity.render(g, this);
          break;
        case VWALL:
        case VFENCE:
          g.glTranslatef(0, 0, 3 * floor + getVerticalWallHeight() / Constants.HEIGHT_MOD);
          g.glRotatef(90, 0, 0, 1);
          float vdiff = getVerticalWallHeightDiff() / 47f;
          if (vdiff < 0) {
            g.glTranslatef(0, 0, -vdiff * 4f);
          }
          deform(g, vdiff);

          Wall vwall = (Wall) entity;
          if (Globals.upCamera) {
            vwall.data.color.use(g, colorMod);
          } else {
            g.glColor3f(1, 1, 1);
          }
          vwall.render(g, this);
          g.glColor3f(1, 1, 1);
          break;
        case HWALL:
        case HFENCE:
          g.glTranslatef(0, 0, 3 * floor + getHorizontalWallHeight() / Constants.HEIGHT_MOD);
          float hdiff = getHorizontalWallHeightDiff() / 47f;
          if (hdiff < 0) {
            g.glTranslatef(0, 0, -hdiff * 4f);
          }
          deform(g, hdiff);
          Wall hwall = (Wall) entity;
          if (Globals.upCamera) {
            hwall.data.color.use(g, colorMod);
          } else {
            g.glColor3f(1, 1, 1);
          }
          hwall.render(g, this);
          g.glColor3f(1, 1, 1);
          break;
        case OBJECT:
          ObjectEntityData objData = (ObjectEntityData) key;
          ObjectLocation loc = objData.getLocation();
          GameObject obj = (GameObject) entity;
          g.glColor3f(colorMod, colorMod, colorMod);
          g.glTranslatef(
              loc.getHorizontalAlign(),
              loc.getVerticalAlign(),
              3 * floor
                  + getHeight(loc.getHorizontalAlign() / 4f, loc.getVerticalAlign() / 4f)
                      / Constants.HEIGHT_MOD);
          obj.render(g, this);
          break;
      }
      g.glPopMatrix();
      g.glColor3f(1, 1, 1);
    }
  }
Ejemplo n.º 24
0
 public void produce(double x, double y) {
   Wall tmp = new Wall(x, y);
   tmp.init(units, tower, grid, weapons, effects);
   tower.add(tmp);
 }
Ejemplo n.º 25
0
  private void processMap() throws SlickException {
    // clears array of walls
    for (int x = 0; x < mapa.getWidth(); x++) {
      for (int y = 0; y < mapa.getHeight(); y++) {
        wallMap[x][y] = 0;
      }
    }
    // detects all objects in the tiled map, sets their position and adds them into level
    for (int i = 0; i < mapa.getObjectCount(0); i++) {
      switch (mapa.getObjectType(0, i)) {
        case "player":
          Player hrac = new Player();
          hrac.setPosition(mapa.getObjectX(0, i), mapa.getObjectY(0, i));
          level.addToLevel(hrac);
          level.setPlayer(hrac);
          break;
        case "blob":
          Blob blob = new Blob();
          blob.setPosition(mapa.getObjectX(0, i), mapa.getObjectY(0, i));
          level.addToLevel(blob);
          break;
        case "cron":
          Cron cron = new Cron();
          cron.setPosition(mapa.getObjectX(0, i), mapa.getObjectY(0, i));
          level.addToLevel(cron);
          break;
        case "broom":
          Broom broom = new Broom();
          broom.setPosition(mapa.getObjectX(0, i), mapa.getObjectY(0, i));
          level.addToLevel(broom);
          break;
        case "fantom":
          Fantom fantom = new Fantom();
          fantom.setPosition(mapa.getObjectX(0, i), mapa.getObjectY(0, i));
          level.addToLevel(fantom);
          break;
        case "bomb":
          BombsUp bomba = new BombsUp();
          bomba.setPosition(mapa.getObjectX(0, i), mapa.getObjectY(0, i));
          level.addToLevel(bomba);
          break;
        case "speed":
          SpeedUp speed = new SpeedUp();
          speed.setPosition(mapa.getObjectX(0, i), mapa.getObjectY(0, i));
          level.addToLevel(speed);
          break;
        case "kick":
          KickUp kick = new KickUp();
          kick.setPosition(mapa.getObjectX(0, i), mapa.getObjectY(0, i));
          level.addToLevel(kick);
          break;
        case "range":
          RangeUp range = new RangeUp();
          range.setPosition(mapa.getObjectX(0, i), mapa.getObjectY(0, i));
          level.addToLevel(range);
          break;
        case "portal":
          Portal portal = new Portal();
          portal.setPosition(mapa.getObjectX(0, i), mapa.getObjectY(0, i));
          level.addToLevel(portal);
          break;
        case "dragon":
          Dragon dragon = new Dragon(mapa.getObjectX(0, i), mapa.getObjectY(0, i));
          //    dragon.setPosition(mapa.getObjectX(0, i), mapa.getObjectY(0, i));
          level.addToLevel(dragon);
          break;
      }
    }
    // detects all walls in tiled map, sets their position and adds them
    // into list and array of walls
    int wallX;
    int wallY;
    for (int i = 0; i < mapa.getObjectCount(1); i++) {
      wallX = mapa.getObjectX(1, i);
      wallY = mapa.getObjectY(1, i);
      wallMap[wallX / 32][wallY / 32] = 1;
      switch (mapa.getObjectType(1, i)) {
        case "wall":
          Wall stena = new Wall();
          Walls.add(stena);
          stena.setPosition(wallX, wallY);
          break;

        case "block":
          Block blok = new Block();
          Walls.add(blok);
          blok.setPosition(wallX, wallY);
          break;
      }
    }
  }
  @Override
  protected void init(final Object... initArgs) {
    this.requestedProfile = ((HumanId) initArgs[0]).getSelfAsValid();
    this.currUserAsVisitor = ((HumanId) initArgs[1]).getSelfAsValid();

    final HumansIdentity currUserAsVisitorHI =
        UserProperty.HUMANS_IDENTITY_CACHE.get((currUserAsVisitor.getHumanId()), "");
    final HumansIdentity requestedProfileHI =
        UserProperty.HUMANS_IDENTITY_CACHE.get((requestedProfile.getHumanId()), "");

    super.setWallProfileName(currUserAsVisitorHI.getHuman().getDisplayName());
    super.setWallProfilePhoto(
        UserProperty.formatProfilePhotoUrl(currUserAsVisitorHI.getHumansIdentityProfilePhoto()));
    super.setWallTitle(
        MessageFormat.format(
            RBGet.gui().getString(TALK_AT_DOWN_TOWN_ER_0_S),
            requestedProfileHI.getHuman().getDisplayName()));

    final int friendCount =
        ((List<HumansNetPeople>)
                $$getHumanUserFromRequest(request)
                    .cache(requestedProfile.getHumanId(), DownTownFlow.FRIENDS))
            .size();

    UCAddFriends:
    if (requestedProfile.equals(currUserAsVisitor)) { // Accessing own profile
      UCInviteFriendsIfNoFriends:
      {
        if (friendCount < 2) {

          $$displayNone(WallWidgetIds.wallWidget);

          String title = "Without followers your updates will be useless";

          // https://upload.wikimedia.org/wikipedia/commons/8/8d/Ambox_padlock_red.svg
          new Info(
              request,
              new InfoCriteria().setImage("/images/What_is_exciting_lately.png"),
              $$(WallWidgetIds.wallGame));

          new Info(
              request,
              new InfoCriteria().setImage("/images/What_is_exciting_lately_Talk.png"),
              $$(WallWidgetIds.wallGame));

          new Info(request, new InfoCriteria(), $$(WallWidgetIds.wallGame)) {
            /**
             * Use this only in conjunction with GENERIC constructor.
             *
             * @param infoCriteria
             */
            @Override
            protected void init(InfoCriteria infoCriteria) {
              UCSetFriendAddWidget:
              {
                String addFollowerTitle = "";

                if (friendCount == 0) {
                  addFollowerTitle = "Add 2 Follower emails To Start Posting!";
                } else if (friendCount == 1) {
                  addFollowerTitle = "Almost there! Add 1 More Follower To Posting!";
                }

                new AdaptableSignup(
                    request,
                    new AdaptableSignupCriteria()
                        .setHumanId(requestedProfile)
                        .setWidgetTitle(addFollowerTitle)
                        .setAdaptableSignupCallback(
                            new AdaptableSignupCallback() {
                              @Override
                              public String afterInvite(final HumanId invitee) {
                                return ai.ilikeplaces.logic.Listeners.widgets
                                        .UserProperty
                                        .HUMANS_IDENTITY_CACHE
                                        .get(invitee.getHumanId(), invitee.getHumanId())
                                        .getHuman()
                                        .getDisplayName()
                                    + " is now following you!";
                              }

                              @Override
                              public String jsToSend(HumanId invitee) {
                                return JSCodeToSend.refreshPageIn(5);
                              }
                            }),
                    $$(InfoIds.InfoAppend));
              }
            }
          };

        } else {

          String addFollowerTitle = "Add more followers!";

          new AdaptableSignup(
              request,
              new AdaptableSignupCriteria()
                  .setHumanId(requestedProfile)
                  .setWidgetTitle(addFollowerTitle)
                  .setAdaptableSignupCallback(
                      new AdaptableSignupCallback() {
                        @Override
                        public String afterInvite(final HumanId invitee) {
                          return ai.ilikeplaces.logic.Listeners.widgets
                                  .UserProperty
                                  .HUMANS_IDENTITY_CACHE
                                  .get(invitee.getHumanId(), invitee.getHumanId())
                                  .getHuman()
                                  .getDisplayName()
                              + " is now following you!";
                        }

                        @Override
                        public String jsToSend(HumanId invitee) {
                          return JSCodeToSend.refreshPageIn(5);
                        }
                      }),
              $$(WallWidgetIds.wallFollowers));
        }
      }
    }

    fetchToEmail();

    final Wall wall =
        DB.getHumanCrudWallLocal(true)
            .readWall(requestedProfile, new Obj<HumanId>(currUserAsVisitor), REFRESH_SPEC)
            .returnValueBadly();
    final List<Msg> wallEntries =
        DB.getHumanCrudWallLocal(true)
            .readWallLastEntries(
                requestedProfile, new Obj<HumanId>(currUserAsVisitor), 25, REFRESH_SPEC_EMPTY)
            .returnValueBadly();

    for (final Msg msg : wallEntries) {
      new UserProperty(request, $$(WallWidgetIds.wallContent), new HumanId(msg.getMsgMetadata())) {
        protected void init(final Object... initArgs) {
          $$(Controller.Page.user_property_content).setTextContent(msg.getMsgContent());
        }
      };
    }

    DB.getHumanCRUDHumansUnseenLocal(false)
        .removeEntry(currUserAsVisitor.getObjectAsValid(), wall.getWallId());

    $$displayWallAsMuted(
        $$(WallWidgetIds.wallMute), wall.getWallMutes().contains(currUserAsVisitor));

    UCFiltering:
    {
      final List<HumansNetPeople> beFriends =
          (List<HumansNetPeople>)
              $$getHumanUserFromRequest(request)
                  .cache(requestedProfile.getHumanId(), DownTownFlow.FRIENDS);

      @_see(
          seeClasses = {
            WallWidgetHumansWall.class,
            PrivateEventDelete.class,
            PrivateEventView.class,
            Tribe.class
          })
      final String peopleFetchToEmail1 =
          new People(
                  request,
                  new PeopleCriteria().setPeople((List<HumanIdFace>) (List<?>) beFriends),
                  $(Controller.Page.Skeleton_left_column))
              .fetchToEmail;

      Loggers.debug("PEOPLE FETCH TO EMAIL CONTENT:" + peopleFetchToEmail1);

      fetchToEmailSetLeftSidebar(peopleFetchToEmail1);
      fetchToEmailSetRightSidebar("&nbsp;");
    }
  }