Eclipse slick2d TiledMap类和路径

时间:2016-07-06 19:57:18

标签: java slick2d tiled

我正在玩slick2d并尝试加载我在计算机上保存的平铺地图。我在创建一个新实例的时候复制了这条路径,但我无法弄清楚需要做什么Eclipse一直说它无法找到资源

import org.newdawn.slick.AppGameContainer;
import org.newdawn.slick.BasicGame;
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.tiled.TiledMap;



public class MyFirstGame extends BasicGame{

public MyFirstGame()
{
    super("My First Game");
}
public static void main(String[] args)
{   
    try
    {
        AppGameContainer app = new AppGameContainer(new MyFirstGame());
        app.setDisplayMode(500, 400, false);
        app.start();
    }
    catch(SlickException e){
        e.printStackTrace();
    }
}


 @Override
    public void init(GameContainer container) throws SlickException
    {
    final TiledMap myMap = new TiledMap("C:\Users\dustin\Desktop\firstGameMape.tmx", true);

    }

    @Override
    public void update(GameContainer container, int delta) throws SlickException
    {
    }

    public void render(GameContainer container, Graphics g) throws SlickException
    {
        myMap.render(0.0);
    }

0 个答案:

没有答案