I want to blink some images in my Simon game, but they are blinking very short. You can hardly see that a light (image) is turned on.
boolean isPlayerReady = false;
ArrayList<Integer> gameList;
ArrayList<Integer> playerList;
int ROUNDS = 20;
int counter = 4;
int gameListPosition = 0;
PImage bg;
PImage green;
PImage red;
PImage blue;
PImage yellow;
int startTime;
int timeOut;
void setup()
{
gameList = new ArrayList<Integer>();
for (int i = 0; i < ROUNDS; i++)
{
gameList.add(int(random(1, 5)));
}
size(685, 565);
bg = loadImage("img/Simon.png");
green = loadImage("img/green.png");
red = loadImage("img/red.png");
blue = loadImage("img/blue.png");
yellow = loadImage("img/yellow.png");
startTime = millis();
timeOut = millis() + 1000;
}
void draw()
{
background(bg);
if (!isPlayerReady)
{
if (millis() >= timeOut)
{
int tone = gameList.get(gameListPosition);
gameListPosition++;
if (tone == 1)
{
image(green, 90, 30);
}
else if (tone == 2)
{
image(red, 325, 30);
}
else if (tone == 3)
{
image(yellow, 90, 260);
}
else if (tone == 4)
{
image(blue, 325, 260);
}
if (gameListPosition == counter)
{
isPlayerReady = !isPlayerReady;
}
timeOut = millis() + 1000;
}
}
Has somebody any hints to show the images a few seconds longer?