Package games.stendhal.tools.tiled

Examples of games.stendhal.tools.tiled.LayerDefinition


    localzone.add(item);
    assertEquals(1, localzone.getItemsOnGround().size());
    assertEquals(0, localzone.getItemsOnGround().toArray(new StackableItem[0])[0].getX());
    assertEquals(0, localzone.getItemsOnGround().toArray(new StackableItem[0])[0].getY());

    LayerDefinition collisionLayer = new LayerDefinition(10, 10);
    collisionLayer.setName("collision");
    collisionLayer.build();
    collisionLayer.set(0, 1, 255);
    localzone.addCollisionLayer("collisionlayer", collisionLayer);

    // now test the displacement action
    final RPAction displace = new RPAction();
    displace.put("type", "displace");
View Full Code Here


    zone.addLayer(name + ".0_floor", zonedata.getLayer("0_floor"));
    zone.addLayer(name + ".1_terrain", zonedata.getLayer("1_terrain"));
    zone.addLayer(name + ".2_object", zonedata.getLayer("2_object"));
    zone.addLayer(name + ".3_roof", zonedata.getLayer("3_roof"));

    final LayerDefinition layer = zonedata.getLayer("4_roof_add");

    if (layer != null) {
      zone.addLayer(name + ".4_roof_add", layer);
    }
View Full Code Here

  /**
   * Tests for createLayerDefintion.
   */
  @Test
  public void testCreateLayerDefintion() throws Exception {
    LayerDefinition layer;
    final int width = 3;
    final int height = 4;
    layer = new LayerDefinition(width, height);
    layer.build();
    layer.set(1, 2, 1);
    layer.set(2, 3, 1);

    final CollisionMap map = new CollisionMap(layer);
    assertThat(map.getWidth(), is(3));
    assertThat(map.getHeight(), is(4));
    for (int x = 0; x < width; x++) {
      for (int y = 0; y < height; y++) {
        final boolean isSet = layer.getTileAt(x, y) != 0;
        assertThat(x + ";" + y, map.get(x, y), is(isSet));
      }
    }

  }
View Full Code Here

  public void startTiming() {
    timeStamp = System.currentTimeMillis();
  }

  private StendhalMapStructure generateMapStructure(int width, int height) {
    LayerDefinition floor = new LayerDefinition(width, height);
    floor.setName("0_floor");
    floor.build();

    LayerDefinition terrain = new LayerDefinition(width, height);
    terrain.setName("1_terrain");

    LayerDefinition object = new LayerDefinition(width, height);
    object.setName("2_object");

    LayerDefinition roof = new LayerDefinition(width, height);
    roof.setName("3_roof");

    LayerDefinition collision = new LayerDefinition(width, height);
    collision.setName("collision");

    LayerDefinition protection = new LayerDefinition(width, height);
    protection.setName("protection");

    StendhalMapStructure map = new StendhalMapStructure(width, height);

    map.addLayer(floor);
    map.addLayer(terrain);
View Full Code Here

      }
    }
  }
 
  public void paint(StendhalMapStructure map) {
    LayerDefinition collision = map.getLayer("collision");
    LayerDefinition ground = map.getLayer("0_floor");
   
    // prepare the floor data arrays for for painting
    ground.build();
   
    Style style = new Style(map);
   
    drawFloor(style, ground, collision);
  }
View Full Code Here

   *
   * @throws ClassNotFoundException
   */
  public void setMapData(final InputStream in) throws IOException,
      ClassNotFoundException {
    final LayerDefinition layer = LayerDefinition.decode(in);
    width = layer.getWidth();
    height = layer.getHeight();

    logger.debug("Layer(" + layer.getName() + "): " + width + "x" + height);

    map = layer.expose();
  }
View Full Code Here

   
    drawFloor(style, ground, collision);
  }
 
  public void paintPortal(StendhalMapStructure map, int x, int y) {
    LayerDefinition ground = map.getLayer("0_floor");
    ground.set(x, y, Style.PORTAL_INDEX);
  }
View Full Code Here

TOP

Related Classes of games.stendhal.tools.tiled.LayerDefinition

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.