1

I'm just starting out trying to work with .tmx files in LibGDX and I seem to be hitting a brick wall. In Eclipse, the following code:

import com.badlogic.gdx.graphics.g2d.tiled.TiledMap;
import com.badlogic.gdx.graphics.g2d.tiled.TmxMapLoader;

public class TiledScreen implements Screen {

    private TiledMap test;

    public TiledScreen(DevMaze g) {

        test = new TmxMapLoader().load("Tiled.tmx");

    }

    ...
}

says that neither TmxMapLoader nor the import can be resolved to a type. I've got the most recent gdx-tools.jar (from the 11/9 nightly-latest.zip) added to the build path for the project and Eclipse recommends changing it to TiledLoader, so it seems like eclipse is seeing that .jar... I'm not really sure what else could be causing this.

Any help is appreciated.

Matt
  • 1,674
  • 2
  • 16
  • 34

1 Answers1

0

You don't need the gdx-tools.jar for this job.

The correct import is actually import com.badlogic.gdx.maps.tiled.TmxMapLoader;. So your package is wrong.

In general: Use this setup tool to create the projects. Then you shouldn't run into any problems.

noone
  • 19,520
  • 5
  • 61
  • 76
  • Any thoughts on why Eclipse wouldn't have noticed this? There was an "import TiledMap" quickfix but nothing for the TmxMapLoader, only a "create new class" option. But thanks for the response, I'll try this ASAP. – Matt Nov 10 '13 at 18:31
  • I noticed that when you define a wrong import, Eclipse gets confused sometimes and is not able to change it anymore. – noone Nov 10 '13 at 20:11