import javax.microedition.lcdui.*; import java.util.*; class EggCanvas extends Canvas{ Timer t=null; TimerTask tt=null; Catcher catcher = null; PointCounter pointCounter = null; EggContainer eggContainer=null; int speed=300; public static final int GAME_NOT_STARTED=0; public static final int GAME_STARTED=1; public static final int GAME_ENDED=2; int gameState=GAME_NOT_STARTED; // When the canvas is shown, we create new timer // and assign a task "movement" to it. public void showNotify() { catcher = new Catcher(0, getWidth(), getHeight()); pointCounter = new PointCounter(0, 3, 1, speed, getWidth(), getHeight()); eggContainer = new EggContainer(catcher, pointCounter, getWidth(),getHeight()); t=new Timer(); tt=new TimerTask() { public void run() { movement(); } }; t.schedule(tt, speed, speed); // tegevus, viivitus, intervall } // Every movement moves all the eggs one step at a time public void movement() { eggContainer.moveEggs(); if (pointCounter.lives<0) { gameState=GAME_ENDED; t.cancel(); } if (pointCounter.speed