CS 201 - Computer Science I - Fall 2008
Project 2


Loyola College > Department of Computer Science > Dr. James Glenn > CS 201 > Projects > Project 2

Due

Monday, October 27th at 11:59pm. Projects submitted after the due date will be assessed a 20% penalty per day. Projects will not be accepted more than four days late.

Objectives

Introduction


This applet requires Java 2 and so will not work with some browsers.
Use the arrow keys to guide your frogs home.

The goal of Calaveras Crossing is to navigate your frogs across the road and river into the niches at the top of the screen. Along the way, you must avoid getting your frogs squished in traffic or drowned in the river. The game ends when you have filled all five niches or killed three frogs.

Assignment

Create a Calaveras Crossing level. To do this, you must work with the Level, Lane, Log, Turtles, Truck, Car, Racecar, and Tractor classes. Documentation, but not source code, is provided for those classes. (Note that there is documentation for classes you will not work with directly, and even in the documentation for the classes you are using directly there are many methods you will not use directly.)

The Lane class represents a horizontal lane of traffic, whether it is road traffic or river traffic. The Level class represents the collection of lanes players navigate their frogs across. All of the other classes listed above represent the various obstacles the frog may encounter. Note that there are currenly no differences between Tractor, Car, and Racecar; you should use these classes for slow, medium, and fast small vehicles and we will make cosmetic changes in Project 3.

In general, to create a level you will instantiate several Lanes, instantiate various obstacles, add them to the lanes using the appropriate method, and then add the lane to the level using the appropriate method. Certain attributes of the obstacles and lanes (speed, width, etc.) can also be set, either by passing arguments to their constuctors when they are instantiated, or by invoking their methods.

Make sure the level you create meets the criteria listed below in the grading section.

Note that horizontal positions and widths are given in terms of the width of the screen: 1.0 for a width means as wide as the screen; 0.25 for a horizontal position means 1/4 of the way from the left edge to the right edge of the screen. The frog, for example, is 0.1 wide (1/10 of the screen).

Files

The archive file calaveras.jar contains compiled .class files only. Extract the .class files using jGRASP's Jar/ZIP extractor just like you would extract .java files. To understand how to use the classes in the archive, see the documentation.

Your code to instantiate levels, lanes, and obstacles goes in CalaverasCrossingWindow.java. To play the game, compile and run that file.

There was a logic error in the original Frog class that prevented your frog from respawning when it floated off the edge of the screen. That error has been corrected. The current version of the archive has the corrected code. You can also download just the single file Frog.class (make sure to save it in the same directory as your other P2 files).

Advice

Grading

Submissions

Submit by e-mail the source code (.java file) for your edited version of CalaverasCrossingWindow.java.