Search code examples
java2d-games

Flicker in snake game develope in java


I have developed a snake game in Java. The problem is that I see a flicker while the game is running. Can anyone please inform me why this is happening and direct me to a possible solution?

The code for the game can be found here.


Solution

  • Have you considered double buffering?

    Looking at your code, what about the following being a potential cause

    Thread.sleep(1000)