您好,我正在尝试在我的 java 游戏中删除一个名为 tree 的图像图标,并且发现我的 if 语句有问题。如果 boolean drawimage 等于 false,我将如何删除图像树?
if(r1.intersects(rectX, rectY, 25, 25)){
g.drawString("Cut Down Some Tree's To Get Some Wood To build Your Base", rectX, rectX);
drawimage = true;
}
if(drawimage){
g.drawImage(tree,175, 75, 50, 50,null);
//Check if the image has cloision
if(r1.intersects(175, 75, 50, 50)){
drawimage = false;
}
if(!drawimage){
}
}
repaint();
}