How to I reference my timer and players and what did you mean by dispensing with that code. I have my code for my timer. Its in my scorepanel actor subclass
public class Scorepanel extends Actor
{
private int timer;
public Scorepanel()
{
timer = 3601;
}
/**
* Act - do whatever the Scorepanel wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
updateTimer();
}
public void updateTimer()
{
timer--;
getWorld().showText("Time Left : "+timer, 270,875);
if (timer == 0)
{
World world = getWorld();
world.addObject(new Gameover(), world.getWidth()/2, world.getHeight()/2);
Greenfoot.playSound("gameover.mp3");
Greenfoot.stop();
}
}
protected void addedToWorld(World world)
{
updateTimer();
}
}
