Nevermind, unlike BuilderBoy's code, I can actually wrap my head around danpost's, no offense. It wouldn't be very fair if I couldn't figure it out myself.
Yes they will danpost, I use them myself for my Nightmare scenario and they work just fine. The issue I assume is that the correct image is not being manipulated. Keep in mind my original code was written without any knowledge of your current routines or implementation, and was just a demonstration. Mirroring Danposts post, a similar method would be like:
public void createPortal(int x, int y, int r) // x and y are the center and r is the radius
{
BufferedImage myBuffer = getImage().getAwtImage();
Graphics2D myGraphics = myBuffer.createGraphics();
AlphaComposite compClear = AlphaComposite.Clear;
myGraphics.setComposite(compClear);
myGraphics.fillOval(x-r,y-r,r*2,r*2);
}
EDIT: Ah ok, well my method will always be here if you run into any sort of speed issues!
I think the point was that all the imported classes are not neccessary to accomplish what was wanted. The inexperienced programmer gets lost in code as you are providing. Hence, RM6442's response of "I can actually wrap my head around danpost's. I believe what he was saying, is that he could understand the code (instead of just blindly using it).
Yes I understand that, hence my edit (which you may or may not have caught due to page refresh D:). But yeah, I understand that your routine is easier to understand, so I am merely providing my routine as a backup at this point if he ever wants to come back and check it out.
Both work, but danpost's right. I want to be able to understand the code I'm putting into this program. I try BuilderBoy's code when I understand what each of the things I had to import mean.
Both codes work as erasers when I attach them to moving objects.
When I had the image recreate itself before at the beginning of the method, I lost the ability to use it on more than one object.
Ah yeah that makes sense. That was probably just a result of adapting my general code to your program without understanding what it meant. So glad you have a routine that works for you, and that you can understand now ^^
Try re-filling the image with black each frame before you cut the holes in the image. What is happening right now is that each time the routine is called, it cuts another hole without filling in the previous one.
Wait, to refill the hole, it would require a way of knowing where it was previously. If I ignore that by simply using a larger oval to refill the hole, there may be problems when two objects meet.