nankin.zheng.gatem.util
Class GameTimer

java.lang.Object
  |
  +--nankin.zheng.gatem.util.GameTimer

public class GameTimer
extends java.lang.Object

A timer used in the game. For example, when pacman eats a big bean, all the timers of fantomes will be started, and will count for a period of time, during which the fantomes are blue and thus weak.

Version:
1.0, Date 2003-04-11
Author:
ZHENG Zhong

Field Summary
private  int alarmLine
           
private  int current
           
private  int max
           
 
Constructor Summary
GameTimer(int max)
          Constructor, set the max value of timer.
 
Method Summary
 void count()
          Count one.
 boolean isAlarming()
          whether is alarming.
 boolean isTimeUp()
          whether time is up
 void reset()
          Reset timer.
 void setAlarmLine(double percent)
          Set alarm line.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

max

private int max

current

private int current

alarmLine

private int alarmLine
Constructor Detail

GameTimer

public GameTimer(int max)
Constructor, set the max value of timer.

Method Detail

setAlarmLine

public void setAlarmLine(double percent)
Set alarm line. The default alarm line is 20% of the max value.


reset

public void reset()
Reset timer. Note that current time counts top-down.


count

public void count()
Count one.


isAlarming

public boolean isAlarming()
whether is alarming.


isTimeUp

public boolean isTimeUp()
whether time is up