我是新手。我正在尝试 wilchit sombat 关于制作 packman 的游戏教程。我无法查看BufferedImage
. 这是覆盖游戏引擎中一些方法的代码。
package game.packman;
import java.awt.Graphics;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
import org.Game.Engine.Game;
import org.Game.Engine.GameApplication;
public class PackMan extends Game {
public static void main(String args[]) {
GameApplication.start(new PackMan());
}
BufferedImage packman;
public PackMan() {
title = "PACKMAN";
width = height = 400;
try {
packman = ImageIO.read(new File("images/pacmanimg.xcf"));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
@Override
public void init() {
// TODO Auto-generated method stub
}
@Override
public void update() {
// TODO Auto-generated method stub
}
@Override
public void draw(Graphics g) {
g.drawImage(packman, 100, 100, null);
}
}