Hi,
I'd like to add a timer that is visible on screen and counts down for 60 seconds and then stops the program if it has expired. I modified the crab & worm example and made it into a 2 player game.
Here's my Level (world subclass) code in case you need it:
Tell me if another bit of the code would be helpful. Do I have to create an actor for the timer?
import greenfoot.*;
public class Level extends World
{
public void act() {
}
public Level()
{
super(1200, 600, 1); // erzeugt eine neue Welt mit 1200x600 Zellen mit einer Zellengrösse von 1x1 Pixeln.
prepare(); // erzeugt eine Grundsituation mit 2 Playern, 2 Enemy und 6 Victims
}
private void prepare()
{
addObject(new Player1(), 300, 300);
addObject(new Player2(), 900, 300);
addObject(new Enemy(), 100, 100);
addObject(new Enemy(), 1100, 500);
addObject(new Victim(), Greenfoot.getRandomNumber(1100), Greenfoot.getRandomNumber(500));
addObject(new Victim(), Greenfoot.getRandomNumber(1100), Greenfoot.getRandomNumber(500));
addObject(new Victim(), Greenfoot.getRandomNumber(1100), Greenfoot.getRandomNumber(500));
addObject(new Victim(), Greenfoot.getRandomNumber(1100), Greenfoot.getRandomNumber(500));
addObject(new Victim(), Greenfoot.getRandomNumber(1100), Greenfoot.getRandomNumber(500));
addObject(new Victim(), Greenfoot.getRandomNumber(1100), Greenfoot.getRandomNumber(500));
}
}

