Package net.sertik.genesia.entity

Examples of net.sertik.genesia.entity.Tile


      @Override
      public void handle(MouseEvent me) {
        if (me.isStillSincePress()) {
          Coords mapCoords = calcMapCoordFromMouseCoord(me.getX(), me.getY());
          if (renderer.getWorld().isPointWithinBounds(mapCoords)) {
            Tile selectedTile = renderer.getWorld().getTile(mapCoords.getX(), mapCoords.getY());
            if (selectedTileInfo.getTileNode() == null
                    || !selectedTile.equals(selectedTileInfo.getTileNode().getTile())) {
              selectedTileInfo.setTileNode(renderer.getResourceLoader().createResource(selectedTile));
            }
          }
        }
      }
View Full Code Here


  public void renderTiles(Group container, double width, double height) {
    if (container.getChildren().isEmpty()) {
      List<Node> nodes = new LinkedList<>();
      for (int i = 0; i < world.getSizeSqrt(); i++) {
        for (int j = 0; j < world.getSizeSqrt(); j++) {
          Tile tile = world.getTile(i, j);
          TileNode node = resourceLoader.createResource(tile);
          if (node != null) {
            node.setLayoutX(World.TILE_WIDTH / 2 * (i - j));
            node.setLayoutY(World.TILE_HEIGHT / 2 * (i + j));
            nodes.add(node);
View Full Code Here

                parentMinY + World.TILE_HEIGHT / 2 * (x + y),
                World.TILE_WIDTH, World.TILE_HEIGHT);
        Point2D point = new Point2D(bounds.getMinX(), bounds.getMinY());
        if (bounds.intersects(checkBounds)) {
          if (!visibleNodes.containsKey(point)) {
            Tile tile = world.getTile(parentOffsetX + x, parentOffsetY + y);
            Node node = resourceLoader.createResource(tile);
            if (node != null) {
              node.setLayoutX(point.getX());
              node.setLayoutY(point.getY());
              visibleNodes.put(point, node);
View Full Code Here

        land.setName("Judokan");
        land.setWorld(world);

        for (int lx = 0; lx < numberTilesSqrt; lx++) {
          for (int ly = 0; ly < numberTilesSqrt; ly++) {
            Tile tile = new Tile();
            tile.setX(lx);
            tile.setY(ly);
            tile.setLand(land);
            if (rand.nextDouble() < lusciousness) {
              tile.getObjects().add(new Scenery("tree"));
            } else {
              tile.getObjects().add(new Scenery("grass"));
            }

            land.getTiles().add(tile);
          }
        }

        // generate flag tile around center
        Tile tile = land.getTile(halfOfNumberTilesSqrt + (rand.nextInt(3) - 1),
                halfOfNumberTilesSqrt + (rand.nextInt(3) - 1));
        tile.getObjects().clear();
        tile.getObjects().add(new Scenery("flag"));

        world.getLands().add(land);
      }
    }
View Full Code Here

  public void setTileNode(TileNode tileNode) {
    this.tileNode = tileNode;
    tileNodeGroup.getChildren().clear();
    tileNodeGroup.getChildren().add(this.tileNode);

    Tile tile = this.tileNode.getTile();
    if (!tile.getObjects().isEmpty()) {
      landName.setText(tile.getLand().getName());
      description.setText(tile.toString());
    } else {
      landName.setText("no land\nselected");
      description.setText("");
    }
  }
View Full Code Here

TOP

Related Classes of net.sertik.genesia.entity.Tile

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.