/*In my code I tried to make my snake change color each time game starts, but it didn't happen like I guessed.When I run the code snake's body change like rainbow in every second.I only want it to change before game starts can someone help me ? */
case SnakeBody:
Random rand = new Random();
Color onlycolor = new Color(rand.nextInt(256), rand.nextInt(100), rand.nextInt(100));
g.setColor(onlycolor);
g.fillRect(x, y, TILE_SIZE, TILE_SIZE);
break;
Aucun commentaire:
Enregistrer un commentaire