문제

I am trying to use Tiled with my Libgdx game. I am having trouble with this line of code:

TiledMapTileLayer layer = (TiledMapTileLayer) tiledMap.getLayers().get(0);

I am getting this error:

Exception in thread "LWJGL Application" java.lang.ClassCastException: com.badlogic.gdx.maps.MapLayer cannot be cast to com.badlogic.gdx.maps.tiled.TiledMapTileLayer

I am using Libgdx 0.9.9

도움이 되었습니까?

해결책

Is the layer a tile layer or an object layer? Only tile layers will be instances of TiledMapTileLayer.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top