Frage

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.

War es hilfreich?

Lösung

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.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top