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

2016/4/7

How can I remove drawn lines?

TinyTertle TinyTertle

2016/4/7

#
For example, if I use drawRect() onto my world image, how can I remove that rectangle without affecting the rest of the world image? A solution I've thought of is to have an actor object that is simply a GreenfootImage with a rectangle drawn on it. I could then add and remove the rectangle to the world image that way. However, this way is extremely clumsy and I'd much rather have something cleaner.
danpost danpost

2016/4/7

#
How badly does it mess up your background? that is, do you have a flat color for the background or is the rectangle placed over multiple different colored pixels in the background without any regular pattern? Why would you say it would be clumsy to add and remove an actor with an image with the rectangle on it? It would not be much easier to save the area that the rectangle will be at and redraw it later.
TinyTertle TinyTertle

2016/4/7

#
The rectangle is simply drawn on the background. There isn't any other "messing up" really. Is saving and redrawing my only alternative?
danpost danpost

2016/4/7

#
If you do not have an image in the world background that is being altered in any way. you could draw the rectangle again in the color of the background of the world (to erase it).
TinyTertle TinyTertle

2016/4/7

#
Haha, yeah I'll definitely just stick to wrapping the image into an Actor object. I appreciate the time and effort though!
You need to login to post a reply.