我的问题是在 Sprite“Sheet”中获取 Sprite。
public class Blocks extends Sprite{
public Blocks() throws IOException
{
super(Image.createImage("/blockSprite.png"),20,30);
}
}
“blockSprite.png 包含 Sprites 图像,一张图像中包含许多 sprite”
这里的问题是使用这行代码,我应该如何获得图像中的 Sprite 大小/尺寸?
Sprite 表:
宽度 - 162
高度 - 280
我想知道工作表中 Sprite 的宽度/高度?以及如何确定 Sprite Sheet 中 Sprite 的宽度/高度?
最佳答案
你知道每行每列有多少个 Sprite 吗?然后只需将宽度除以一列中有多少 Sprite ,将高度除以一行中有多少 Sprite 。
(我可能把列和行弄错了,我不是英语母语,但如果第一次尝试没有成功,你应该换行/列)
关于java-me - 如何获取 Sprite "Sheet"中 Sprite 的大小?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9052229/