Interface 29
Sun Jan 07 2024 18:38:18 GMT+0000 (Coordinated Universal Time)
Saved by
@马丽
void pickRandomColor() {
// Pick a random color and display the corresponding color
int randomIndex = int(random(colorKeys.length));
char selectedColor = colorKeys[randomIndex];
if (selectedColor == 'R') {
circleFillColor = color(255, 0, 0); // Red
} else if (selectedColor == 'G') {
circleFillColor = color(0, 255, 0); // Green
} else if (selectedColor == 'B') {
circleFillColor = color(0, 0, 255); // Blue
}
}
char getColorChar(int fillColor) {
// Get the character corresponding to the color
if (fillColor == color(0, 255, 0)) {
return 'G';
} else if (fillColor == color(255, 0, 0)) {
return 'R';
} else if (fillColor == color(0, 0, 255)) {
return 'B';
}
return ' ';
}
void gameOver() {
// Display game over message
fill(0, 0, 2);
textSize(80);
textAlign(CENTER);
text("Game Over!", width / 2, height / 2);
// Show information about waste recycling in a new window
showRecyclingInfo();
}
content_copyCOPY
Comments