I am making a game. You can try what i have done so far here
But i have some problems about flickering in the game. First one is when the frames of the player are drawn the first time it flickers alot. I have no idea why it does that because i load all the images when the game starts.
Then the other problem is when I draw the background which consists of many 20X20 pictures. If i have the game like 500x500 it works good but if i have it 1000x1000 it flickers in the lower right corner. Here is the code i use to paint the background:
I use this for painting:
Is there something wrong in painting this way. I have modified my game from a pacman tutorial which had painting done this way.
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
First, at what rate are you refreshing the screen? Do you have a set Thread.sleep() time? From a while back I remember that a refresh of around 80 ms was OK (for the machine I was on), but that anything faster would flicker because it was just trying to refresh too fast...
Second, could be a separate threading problem if you are using multiple threads to control your game...
Third, it could be that 1000x1000 is just *too big* to be refreshed quickly enough without artifacts... in this case you'll either have to change your game architecture to be "quicker" (changing the redraw so it doesn't redraw the whole screen every time, but keeps track of "dirty" areas and only redraws those) or use libraries that let you get "closer to the metal" like JOGL or LWJGL.
Write once, run anywhere, because there's nowhere to hide! - /. A.C.