Game - import import import import import import import...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
import java.awt.Canvas; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics2D; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.awt.image.BufferStrategy; import javax.swing.JFrame; import javax.swing.JPanel; /** * @original author Kevin Glass * @adapted by: Nikunj Raghuvanshi * @adapted by: Kye Hedlund 3/2010 * @adapte by Wade Gobel 10/2010 */ public class Game extends Canvas { //*************** do not change between this line and the next one *** // CONSTANTS /** True if we're holding up game play until a key has been pressed */ private boolean waitingForKeyPress = false;//true; /** True if the left cursor key is currently pressed */ private boolean leftPressed = false; /** True if the right cursor key is currently pressed */ private boolean rightPressed = false; /** True if we are firing */ private boolean firePressed = false; // Graphics stuff private Graphics2D g; private BufferStrategy strategy; // Use accelerated page flipping //***************** do not change above this line ********** // Time (in ms) to pause after each step of the game loop. // This, in part, determines the speed at which the game is // updated on the screen. public final int PAUSE_INTERVAL = 30; public final int SCREEN_WIDTH = 800; public final int SCREEN_HEIGHT = 600; final int NUMBER_OF_ALIENS = 5; // VARIABLES private Alien alien; private Canon canon; private Bullet bullet; private RowOfAlien row; public boolean winGame; public int winCount; public int lossCount; /* * Create a new game that is ready to play */
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
public Game() { graphicsInitialization();
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 06/10/2011 for the course COMP 110 taught by Professor Stotts during the Spring '08 term at UNC.

Page1 / 6

Game - import import import import import import import...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online