I've created a delay timer for my actor to create a blinking "start game" button, but when I run the game it doesn't blink.
Here is my code:
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class StartGameButton here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class StartGameButton extends Actor
{
private int delay = 0;
/**
* Act - do whatever the StartGameButton wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
startingGame();
blinkingImage();
}
public void setDelay(int d)
{
delay = d;
}
public void blinkingImage()
{
GreenfootImage button = getImage();
int t = button.getTransparency();
button.setTransparency(0);
setDelay(100);
if (delay>0)
{
delay--;
return;
}
button.setTransparency(t);
}
public void startingGame()
{
if(Greenfoot.mouseClicked(this))
{
Greenfoot.setWorld(new GuessThatPokemon());
}
}
}

