我最近尝试将我的文件整理成包,一切顺利,但现在我不知道如何导入包含所有图像的包,之后我不知道如何定位图像一旦导入。
package game.character;
import game.tasks.ImageMake;
import game.character.MoveCha;
import game.images.SpriteSheet.png;
import java.awt.Graphics;
import java.awt.Graphics2D;
import javax.swing.JPanel;
public class DrawCha extends JPanel {
public MoveCha move;
public ImageMake imgm;
@Override
public void paintComponent(Graphics g) {
imgm = new ImageMake();
super.paintComponent(g);
Graphics2D g2d = (Graphics2D) g;
move = new MoveCha();
g2d.drawImage(
imgm.createImg("SpriteSheet.png"),
move.getX(),
move.getY(),
move.getX() + 40,
move.getY() + 64,
0,
0,
10,
16,
this
);
}
}
当我尝试编译所有内容时,我得到一个错误,说"包game.images.SpriteSheet不存在"我不熟悉使用软件包,也不完全了解它们是如何工作的,提前感谢!