hello, i am working on a timer class for my game where after the timer hits zero, the game ends and i display a text however it is not working can someone point out what i am doing wrong? :
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 timer extends Actor
{
public int timer_;
/**
* 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 act()
{
countdown();
}
public void countdown()
{
for(int timer_ = 5; timer_ >= 5; timer_-- )
{
if(timer_ == 0)
{
Greenfoot.stop();
GreenfootImage img = new GreenfootImage(4,5);
img.drawString("You are out of time",4,5);
img.setColor(Color.ORANGE);
}
}
}
}