Package org.newdawn.slick.tiled

Examples of org.newdawn.slick.tiled.TiledMap$GroupObject


   
    /** Create a new World object. */
    public World()
    throws SlickException
    {
        map = new TiledMap(Game.ASSETS_PATH + "/map.tmx", Game.ASSETS_PATH);
        player = new Player(1296, 13616-Panel.PANEL_HEIGHT);
        panel = new Panel();
       
        // Instantiate lists
        items = new ArrayList<Item>();
View Full Code Here


   * @param type
   *            the building type
   * @return true if the building type can be built on the given tile
   */
  public static boolean tileIsBuildable(int x, int y, BuildingType type) {
    TiledMap map = GameData.getSelectedColony().getMap();
    final int width = map.getWidth();
    final int height = map.getHeight();
    if (x < 0 || y < 0 || x > width || y > height) {
      // Coords are out of the map
      return false;
    }

View Full Code Here

   * @param y
   *            Y coordinate of the tile
   * @return true if the tile is OK
   */
  public static boolean isValidCommandCenterTile(int x, int y){
    TiledMap map = GameData.getSelectedColony().getMap();
    final int width = map.getWidth();
    final int height = map.getHeight();
    if(x < 1 || y < 1 || x > width || y > height){
      return false;
    }
    return true;
  }
View Full Code Here

  @Override
  public void initState() throws SlickException {

    // TODO externalize this part
    // Load the tiledmap
    TiledMap tiledMap = new TiledMap("data/testmap.tmx");

    Colony c = new Colony();
    c.setAvailableRobots(3);
    c.setTotalRobots(3);
    c.setMap(tiledMap);
View Full Code Here

      if (BuildingType.COMMAND_CENTER.equals(a.getBuilding().getType())) {
        // There is already a command center under construction
        return;
      }
    }
    TiledMap map = GameData.getSelectedColony().getMap();
    final int mapWidth = map.getWidth();
    final int mapHeight = map.getHeight();

    if (!TileHelper.isValidCommandCenterTile(tileX, tileY)) {
      // TODO Play error sound
      // The zone is not correct for Command Center construction.
      return;
View Full Code Here

    this.y = BigDecimal.valueOf(y);

    this.miniMapZone = new Rectangle(this.x.intValue(), this.y.intValue(),
        WIDTH.intValue() + 1, HEIGHT.intValue() + 1);

    TiledMap tiledMap = GameData.getCurrentMap();
    final BigDecimal tileWidth = BigDecimal
        .valueOf(tiledMap.getTileWidth());
    final BigDecimal tileHeight = BigDecimal.valueOf(tiledMap
        .getTileHeight());
    final BigDecimal tileNumberX = BigDecimal.valueOf(tiledMap.getWidth());
    final BigDecimal tileNumberY = BigDecimal.valueOf(tiledMap.getHeight());

    this.mapWidth = tileWidth.multiply(tileNumberX);
    this.mapHeight = tileHeight.multiply(tileNumberY);
  }
View Full Code Here

    this.mapWidth = tileWidth.multiply(tileNumberX);
    this.mapHeight = tileHeight.multiply(tileNumberY);
  }

  public void render(Graphics g) throws SlickException {
    TiledMap map = GameData.getCurrentMap();

    BigDecimal scaleX = WIDTH.divide(this.mapWidth);
    BigDecimal scaleY = HEIGHT.divide(this.mapHeight);

    Color lastColor = g.getColor();

    g.scale(scaleX.floatValue(), scaleY.floatValue());

    BigDecimal scaledX = this.x.multiply(this.mapWidth).divide(WIDTH, 0);
    BigDecimal scaledY = this.y.multiply(this.mapHeight).divide(HEIGHT, 0);

    map.render(scaledX.intValue(), scaledY.intValue(),
        TileHelper.DECO_LAYER);

    // Rendering of buildings representations (squares of the caregory
    // color)
    List<Building> buildings = GameData.getSelectedColony().getBuildings();
View Full Code Here

      public void run() {
        final Colony c = new Colony();
        c.setName(PlanetState.this.colonyNameField.getText());
        PlanetState.this.colonyNameField.setText("");
        try {
          c.setMap(new TiledMap("data/testmap.tmx"));
        } catch (SlickException e) {
          // TODO Handle TiledMap loading in a manager
          e.printStackTrace();
        }
        c.setResource(Resource.CRISTAL, BigDecimal.valueOf(1000));
View Full Code Here

        super(gamename);
    }

    @Override
    public void init(GameContainer gc) throws SlickException {
        map = new TiledMap("resources/maps/test3.tmx");
        player = new Player("resources/dirt.png", 50, 50);
        System.out.println(map.getTileId(10,10,0));
        x = 100;
    }
View Full Code Here

  public void init(GameContainer container) throws SlickException {
    // load the sprites and tiles, note that underneath the texture
    // will be shared between the sprite sheet and tilemap
    SpriteSheet sheet = new SpriteSheet("testdata/scroller/sprites.png",32,32);
    // load the tilemap created the TileD tool
    map = new TiledMap("testdata/scroller/map.tmx");
   
    // build a collision map based on tile properties in the TileD map
    blocked = new boolean[map.getWidth()][map.getHeight()];
    for (int x=0;x<map.getWidth();x++) {
      for (int y=0;y<map.getHeight();y++) {
View Full Code Here

TOP

Related Classes of org.newdawn.slick.tiled.TiledMap$GroupObject

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.