Your source code is there:
http://prime.turquoisegrotto.com/java/bluefiend.java
Isn’t it?
I’m watching it now. I would like to discover why it requires 3 Ghz. Please split your source code into several classes/files, 1719 lines in a single file are a bit too much. Put the classes bullet, ship, enemy, boss… into separate files. It would be better if you added more comments too. Thank you very much for open sourcing it.
The bottleneck seems to be there:
buff = new BufferedImage(size.width,size.height, BufferedImage.TYPE_INT_ARGB);
g2i = buff.createGraphics();
g2i.setComposite(ac);
You create a new BufferedImage in the paint method that is called often of course. The use of alpha composite is costly too. I’m trying to understand how to work around this. Avoid recreating fonts and colors in the paint method too even though the impact on the frame rate is tiny.
Are you sure you need the line below in the main loop?
Thread.sleep(10);
It would be required in C++ but not in Java as the JVM is able to do what is necessary to drive this useless.
In the class bullet, lots of “new” calls could be avoided as the array called “bounds” contains 4 points. You should rather call “new” once for the array, once for each point inside the array and after that, modify the coordinates of the points in your methods update and update2. I do the same remark for the classes called “enemy”, “boss” and “ship”.
public class bluefiend extends JFrame implements KeyListener, MouseListener, MouseMotionListener
Maybe separate the JFrame, the KeyListener, the MouseListener and the MouseMotionListener (principle of “separation of concerns”).