CS 104 Project
100 points
Objective: | To gain experience with writing a complete program, combining techniques learned in class and to have fun! | |
Hypothesis: | The design of the program. | |
Solution: | A complete program with proper format and comments. A statement explaining how your hypothesis was tested and what you have learned in this process |
For this project, you will design and implement a substantial game that combines the ideas you have learned in class. You have three options: you can implement a Tetris game, a Mine Sweeper game, or design and implement your own game.
Your project (worth 100 points) will be graded based on the following:
Write a program that implements the popular game Tetris. The game consists of two classes:
For extra credit, You may also implement an automated solver such that when the player clicks the mouse, the current game piece will be place in a proper position.
To allow the game to react to key presses, import java.awt.event.*
, call addKeyListeners();
in the
init or the run method, and use the following expression.
public void keyPressed(KeyEvent e){ // press up botton, rotate if(e.getKeyCode() == KeyEvent.VK_UP) { ... } // press left botton, shift left if(e.getKeyCode() == KeyEvent.VK_LEFT){ ... } // press right button, shift right if(e.getKeyCode() == KeyEvent.VK_RIGHT) { ... } // press down button, add speed if(e.getKeyCode() == KeyEvent.VK_DOWN) { ... } }
Below is a demo of what we have in mind.
For this option, you will write a game in which a player explores and finds land mines in a field.
The game opens with a 10x10 grid of cells. 10% of the cells contain mines. The player play the game with the following options:
To distinguish the left button from the right button of a mouse event, import
java.awt.event.*
, call addMouseListeners();
in the
init or the run method, and use the following expression. Note that you will
need to explicitely extract the mouse point from the mouse event.
public void mousePressed(MouseEvent e) { ... double x = e.getPoint().getX(); double y = e.getPoint().getY(); if (e.getButton() == MouseEvent.BUTTON1) { ... } else { ... } }
Below is a demo of what we have in mind.
There is no formal restrictions on what kind of game you write, however, you should following the following guidelines:
GraphicsProgram
) and should contain animation.RandomGenerator
and the following
graphical objects: GLabel
, GRect
(or GOval
),
GImage
, GPolygon
, GCompound
.For demonstration purpose and as an inspiration, take a look at games developed by the previous students as a project of CS104.
There are some selected game programs developed by students at Lafayette College as a project of CS104: Game Programming.
Click on the screenshot to load the game. May require installation of Java
plug-in.
Battle City
|
![]() |
Helicopter Game |
![]() |
Lights Out
|
![]() |
Night Raid |
![]() |
Rat on a Scotter |
![]() |
Runner Game |
![]() |
Tower Defense |
![]() |