frequency wrote...
I dont know how to syntax the bool!public static boolean done; // or 'finished', 'completed', 'elapsed', 'gameOver' or whatever
private long endTime;
public static boolean done; // or 'finished', 'completed', 'elapsed', 'gameOver' or whatever
private long endTime;
updateImage();
if (done) return;
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
import java.awt.Color;
/**
* Write a description of class Timer here.
*
* @author (your name)
* @version (a version number or a date)
*/
public static boolean done; // or 'finished', 'completed', 'elapsed', 'gameOver' or whatever
public class Timer30 extends thirty_seconds
{
private static final Color TEXT_COLOR = new Color(255,255,255);
private static final Color TRANSPARENT_COLOR = new Color(0,0,0,0);
private long timeStarted;
/**
* Act - do whatever the Timer wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void Timer()
{
updateImage();
timeStarted=System.currentTimeMillis();
}
public void act()
{
if (done) return;
private long endTime;
updateImage();
if (System.currentTimeMillis()-timeStarted>1000)
{
timeStarted=System.currentTimeMillis();
}
}
private void updateImage()
{
String text="Seconds left";
GreenfootImage image =new GreenfootImage(text,30,TEXT_COLOR,TRANSPARENT_COLOR);
setImage(image);
}
}import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
import java.awt.Color;
/**
* Write a description of class Timer here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Timer30 extends thirty_seconds
{
private static final Color TEXT_COLOR = new Color(255,255,255);
private static final Color TRANSPARENT_COLOR = new Color(0,0,0,0);
private long endTime;
public static boolean done; // or 'finished',
/**
* Act - do whatever the Timer wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void Timer()
{
updateImage();
endTime=System.currentTimeMillis();
}
public void act()
{
if (done) return;
}
private void updateImage()
{
String text="Seconds left";
GreenfootImage image =new GreenfootImage(text,30,TEXT_COLOR,TRANSPARENT_COLOR);
setImage(image);
}
}