This site requires JavaScript, please enable it in your browser!
Greenfoot back
JonahZW
JonahZW wrote ...

2017/5/18

I can't remove a GreenfootImage

JonahZW JonahZW

2017/5/18

#
Hello everyone, I'm having a little trouble with my code, and was wondering if you could help.
public void addText()
{
    GreenfootImage main = getBackground();

    GreenfootImage line01 = new GreenfootImage("Test", 45, WHITE, Color.BLACK);
    main.drawImage(line01, (main.getWidth() - line01.getWidth()) / 2, 30);

    if (mouseClicked(line01))
    {
        main.clear()
    }
}
I'm trying to make it so that when this text gets clicked, it is removed. Does anyone have any suggestions? Thanks in advance!
danpost danpost

2017/5/18

#
Use an actor to display the text so that the background image is not affected.
JonahZW JonahZW

2017/5/19

#
Thank you!
You need to login to post a reply.