簡體   English   中英

在 LibGDX 項目中找不到資產

[英]Assets can't be found in LibGDX project

問題:我用 Tiled 創建了一個游戲 map 並將其導入到 LibGDX 項目的核心資產目錄中。 但是,在運行應用程序時無法找到這些資產。

錯誤: com.badlogix.gdx.utils.GdxRuntimeException:找不到文件:Sprites/Tilesets/PixelFantasy_Caves_1.0/background1.png(內部)

運行配置

map 被加載到這個 class 中:

public class PlayView implements Screen {

    private Sirius game;
    private OrthographicCamera spielCam;
    private Viewport spielPort;
    private Hud hud;

    private TmxMapLoader mapLoader;
    private TiledMap map;
    private OrthogonalTiledMapRenderer renderer;

    public PlayView(Sirius game) {
        this.game = game;
        spielCam = new OrthographicCamera();
        spielPort = new FitViewport(Sirius.V_WIDTH, Sirius.V_HEIGHT, spielCam);
        hud = new Hud(game.batch);

        mapLoader = new TmxMapLoader();
        map = mapLoader.load("siriusMap.tmx");
        renderer = new OrthogonalTiledMapRenderer(map);
        spielCam.position.set(spielPort.getWorldWidth() / 2, spielPort.getWorldHeight() / 2, 0);
    }

找到了解決方法。 如果 Tiled 項目是在 libGDX 項目的 core/assets 目錄中創建的,則不會發生錯誤。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM