I tried today to use the System.nanoTime and System.currenTimeMillis but obviously I’m too stupid to build a timer with it. I searched this forum and google, but I haven’t found a good instruction for it. If I use a Thread for it, nothing would be won, am I right? So can you please tell me how I build a timer with them?
The file size doesn’t matter? I believe you, but maybe you can explain to me why the whole game was lagging and shaking, when we used the high quality backgrounds? Then we decided to use a low quality background and it run a lot more fluid.
Then I tried using BufferStrategy, but I must have done something wrong. At first I used the tutorial I found at: http://gpwiki.org/index.php/Java:Tutorials:Double_Buffering
At first everything looked fine:

And then it destroyed the status panel I used:

The score and defeated enemies are blinking when they get updated for a really short moment they are displayed on the screen. Then I tried to change the level Jpanel into a Level Canvas and tried to add it with: frame.getContentPane().add(canvas);
But then I get a grey background. Then I tried to change the paintComponent() method in paint() methods, but then I get nullpointerexception about graphics g.
It’s crazy… maybe it’s not necessary? Or is it that good for the performance? I have read that it’s not good to use canvas with swing?The thing with double checking… there is no reason for doing it… only stupidity. Fixed it!

At the moment I’m loading the image each time a shot is created. We thought about that ourselves and tried to change it. Do you know a good way to do it? Maybe a ImageLibrary class? In which all images are loaded and then you give in the level paintComponent() method:
public void paintComponent(Graphics G, BufferedImage spaceship)
Is this a good way? I started to build this class, but now I’m too tired and can’t concentrate any more. I will do it like that tomorrow and maybe it runs faster with it.
At the moment we are using BufferedImages. I read that I should use VolatileImages? But then I read, that the BufferedImages are way better in the actual versions?!?
Or do you mean the photoshop output?
That are mainly pngs, just the background is a jpg. I have run the application with -Dsun.java2d.trace=log and the output was:Quote
sun.java2d.loops.MaskBlit::MaskBlit(IntArgb, SrcOver, IntRgb)sun.java2d.loops.Blit$GeneralMaskBlit::Blit(IntArgb, SrcOverNoEa, "Integer RGB DirectDraw")
sun.java2d.loops.MaskBlit::MaskBlit(IntArgb, SrcOver, IntRgb)s
un.java2d.loops.Blit$GeneralMaskBlit::Blit(IntArgb, SrcOverNoEa, "Integer RGB DirectDraw")
sun.java2d.loops.MaskBlit::MaskBlit(IntArgb, SrcOver, IntRgb)s
un.java2d.loops.Blit$GeneralMaskBlit::Blit(IntArgb, SrcOverNoEa, "Integer RGB DirectDraw")
sun.java2d.loops.MaskBlit::MaskBlit(IntArgb, SrcOver, IntRgb)
sun.java2d.loops.Blit$GeneralMaskBlit::Blit(IntArgb, SrcOverNoEa, "Integer RGB DirectDraw")
sun.java2d.loops.MaskBlit::MaskBlit(IntArgb, SrcOver, IntRgb)
sun.java2d.loops.Blit$GeneralMaskBlit::Blit(IntArgb, SrcOverNoEa, "Integer RGB DirectDraw")
sun.java2d.loops.MaskBlit::MaskBlit(IntArgb, SrcOver, IntRgb) sun.java2d.loops.DrawGlyphListAA::DrawGlyphListAA(AnyColor, SrcNoEa, IntRgb)
sun.java2d.loops.MaskBlit::MaskBlit(IntArgb, SrcOver, IntRgb)s
un.java2d.loops.Blit$GeneralMaskBlit::Blit(IntArgb, SrcOverNoEa, "Integer RGB DirectDraw")
sun.java2d.loops.MaskBlit::MaskBlit(IntArgb, SrcOver, IntRgb)s
un.java2d.loops.Blit$GeneralMaskBlit::Blit(IntArgb, SrcOverNoEa, "Integer RGB DirectDraw")
sun.java2d.loops.MaskBlit::MaskBlit(IntArgb, SrcOver, IntRgb)
sun.java2d.loops.Blit$GeneralMaskBlit::Blit(IntArgb, SrcOverNoEa, "Integer RGB DirectDraw")
sun.java2d.loops.MaskBlit::MaskBlit(IntArgb, SrcOver, IntRgb)
sun.java2d.loops.Blit$GeneralMaskBlit::Blit(IntArgb, SrcOverNoEa, "Integer RGB DirectDraw")
sun.java2d.loops.MaskBlit::MaskBlit(IntArgb, SrcOver, IntRgb) sun.java2d.loops.DrawGlyphListAA::DrawGlyphListAA(AnyColor, SrcNoEa, IntRgb)
But I don’t unterstand it.
I will try the createCompatibleImage() tomorrow… if it’s a better way to handle the images. And I will look how I can make them opaque. Then I let the method run with -Dsun.java2d.opengl=True
On my main computer the cpu usage was lower then, but on my laptop the content of the window didn’t load…

Oh… and we are running Java on 1.6.
Again: Thank you very much. It’s really fun to make a game, although we are totally beginners. Maybe sometimes it will run as fast as it should…


). So it would be great, if anyone out there could help us, but thanks for taking the time reading all this anyway. Of course we would be grateful for hints on the net, but the whole possibilities in using 2D and Images some kind of overwhelmed us, that's why we decided to post something here.
