Driver program for the SpaceInvaders demonstration of "framework" code and inheritance hierarchy.
Constructor Summary
()
Method Summary
static java.awt.Image
(java.lang.String name) Returns an Image object with data loaded from a file in the "user directory" (typically the directory where the Java .class file is located) Pauses the program until image is loaded.
static java.applet.AudioClip
(java.lang.String name) Loads a sound file (see main Java documentation for supported sound formats) File should be in "user directory".
public static java.awt.Image getImage(java.lang.String name)
Returns an Image object with data loaded from a file in the "user directory" (typically the directory where the Java .class file is located) Pauses the program until image is loaded.
Parameters:
name - Name of file with image
Returns:
Image object
getSound
public static java.applet.AudioClip getSound(java.lang.String name)
Loads a sound file (see main Java documentation for supported sound formats) File should be in "user directory". Terminates program if get error input.
Parameters:
name - Name of file with sound
Returns:
AudioClip object
main
public static void main(java.lang.String[] args)
Main function. Creates a JFrame to hold the display and deals with window closing events. Creates the main Game object. (You might want to edit the argument to Game constructor - this argument defines the number of invaders that are to be attacking. Could be increased for faster machines and better players, decreased for slower machines.) Creates the display elements, links things up, leaves program running in graphics thread.