我用Java编写我的第一个游戏。所以我有Board类扩展JPanel,并且在这个类中我有paintComponent方法。卡片图像是BufferedImages。如何将颜色层添加到paintComponent方法中的图像?
现在...我刚刚完成了方法,计算可能的球员移动。为了说明一下,我有敌人卡场,并且每当敌方卡场在玩家移动范围内时,我想为敌人卡场图添加一些图层。
我在的paintComponent方法的代码是这样的:
if(!field.isWithinMove()){
//draw normal state card
g.drawImage(field.getLoadedCard().getCardImage(),
field.getX(), field.getY(), Card.cardWidth, Card.cardHeight, null);
}
else{
//there should be a card picture with layer of color
}
我的目标是:
正常:
突出显示:
我将不胜感激您的帮助:)
干杯!
非常感谢您! :) –