I try to create an one second delay between alternating the transparency levels of img2 but it doesn't even reach point 1
Class located in my main world. Any suggestions how to fix it ?
Undead
long timer = 0;
boolean visible= true;
public void alternating()
{
timer = System.currentTimeMillis();
System.out.println("Point 0");
if (visible == true){
if (System.currentTimeMillis() - timer >= 1000)
{
img2.setTransparency(0);
visible = false;
timer = 0;
System.out.println("Point 1");
alternating();
}
} else {
if (System.currentTimeMillis() - timer >= 1000)
{
img2.setTransparency(255);
visible = true;
timer = 0;
System.out.println("Point 2");
alternating();
}
}
}
