如何删除java中的图像图标?

时间:2013-06-04 11:28:44

标签: java image variables if-statement

你好我想在我的java游戏中删除一个名为treeicon的imageicon,我发现我的if语句有问题。如果布尔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();
}

1 个答案:

答案 0 :(得分:0)

更正您的代码 if(drawimage = false){ }

if(drawimage == false){ }

if(!drawimage){    }