TargetGame
GameTimer.java
//-----------------------------------------------------------------------------
// Class: GameTimer
// Author: Written by Chuck Cusack
// Date: September 2001
// Description: Controls the time the game can be played
//-----------------------------------------------------------------------------
import aLibrary.EventTimer;
import java.awt.*;
import java.awt.event.*;
//-----------------------------------------------------------------------------
public class GameTimer extends EventTimer {
//-----------------------------------------------------------------------------
// instance variables
//
private TargetGame theTargetGame; // the controlling director.
private int timeLeft;
//-----------------------------------------------------------------------------
// constructor
//
public GameTimer(int time,TargetGame D) {
super();
timeLeft=time;
theTargetGame=D;
}
//-----------------------------------------------------------------------------
// When an event is triggered, move the target.
//
public void actionPerformed(ActionEvent e) {
timeLeft--;
theTargetGame.updateTime(timeLeft);
}
//-----------------------------------------------------------------------------
}
|