尝试运行程序MOBGame时出现此错误。
Exception in thread "main" java.lang.NoSuchMethodError: org.newdawn.slick.Font.drawString(FFLjava/lang/CharSequence;)V
at org.newdawn.slick.GameContainer.updateAndRender(GameContainer.java:711)
at org.newdawn.slick.AppGameContainer.gameLoop(AppGameContainer.java:456)
at org.newdawn.slick.AppGameContainer.start(AppGameContainer.java:361)
at org.graysontsa.vgdesign.MOBGame.main(MOBGame.java:27)
该文件的来源是:
import org.newdawn.slick.state.StateBasedGame;
import org.newdawn.slick.AppGameContainer;
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.SlickException;
public class MOBGame extends StateBasedGame{
public static final int STARTSCREENSTATE = 0;
public static final int GAMESTATE = 1;
public MOBGame(){
super("MOB");
//this.addState(new StartScreenState(STARTSCREENSTATE));
this.addState(new GameState(GAMESTATE));
this.enterState(GAMESTATE);
//this.enterState(STARTSCREENSTATE);
}
public static void main(String[] args){
try{
AppGameContainer app = new AppGameContainer(new MOBGame());
app.setDisplayMode(640, 480, false);
app.start();
}catch (SlickException e){
e.printStackTrace();
}
}
@Override
public void initStatesList(GameContainer gameContainer) throws SlickException {
// this.getState(STARTSCREENSTATE).init(gameContainer, this);
this.getState(GAMESTATE).init(gameContainer, this);
}
}
我已经用另一个程序对此进行了测试,并且它也适用于此。但是,它不想使用它,这两个文件非常相似,只是我在这个程序中使用状态。