my timer doesnt seem to be running... It's stuck at "hrs 00mins 00sec" whenever i run it
here's the code:
import greenfoot.*; public class MyWorld extends World { // fields usually (by convention) go first GifImage gifImg = new GifImage("Umaru.gif"); private Actor TimeDisplay = new SimpleActor(); private int frames; private int Countdown; public float AYen; //precise public int DYen; //rounded public Yen YenDisplay = new Yen(); public int getHeight = 552 ; public int getWidth = 1200 ; // class constructors usually (by convention) go next public void gifAnimation() { for (Object obj : gifImg.getImages()) ((GreenfootImage)obj).scale(getWidth(), getHeight()); setBackground(gifImg.getCurrentImage()); } public MyWorld() { //For building the world window size super(1400, 675, 1); //For updating the Yen Display adjustYen(0); // to initialize image prepare(); addObject(YenDisplay, 1265, 50); // wherever //For updating the time display updateTimeDisplay(); addObject(TimeDisplay, 1265, 20); //For triggering the minigame Cooldown(); } // methods (by convention) go last //For GIF background public void act() { gifAnimation(); } //For Yen Display stuff public int getAccumulatedYen() { return DYen; } public void adjustYen(float adjustment) { AYen += adjustment; DYen = (int) AYen; YenDisplay.setImage(new GreenfootImage("Yen: "+DYen+"¥", 20, Color.BLACK, new Color(0, 0, 0, 0))); } //For Time Display stuff private void updateTimeDisplay() { int Time = frames/55; String hours = "0"+(Time/3600); String minutes = "0"+(Time/60); String seconds = "0"+(Time%60); String hrs = hours.substring(minutes.length()); String mins = minutes.substring(minutes.length()-2); String secs = seconds.substring(seconds.length()-2); String TimeFormat = "Time: "+hrs+"hrs "+mins+"mins "+secs+"secs"; //Preview: Time: 12345hrs 12mins 12secs TimeDisplay.setImage(new GreenfootImage(TimeFormat, 20, Color.BLACK, new Color(0, 0, 0, 0))); } //For Choosing the Minigame and timing the appearance of the Minigame private void Cooldown() { int Time = frames/55; if (Countdown == 0) { Countdown += 2+(1 + Greenfoot.getRandomNumber(5)); //chooses a cooldown time between 3-7 minutes randomly Minigame(); } Countdown-=Time/60; } private void Minigame() { } //For placing actors into the world private void prepare() { addObject(new Umaru(), 700, 338); } }