Programming Resources
For Fun and Learning
Charles Cusack
Computer Science
Hope College
main

Python
C++

JAVA


PHP
SQL
Alice

TargetGame


Description

Run it
Download jar file (Right click)

ABullet.java
AClip.java
AClipGun.java
ATarget.java
AppletStarter.java
BulletTimer.java
GameTimer.java
LSBullet.java
LSClip.java
LSGun.java
ResetButton.java
TargetGame.java
TargetTimer.java

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);
  }
//-----------------------------------------------------------------------------
}