Computer Science 20S Assignment Create your own game with the

advertisement
Computer Science 20S Assignment
Create your own game with the following requirements:
1. Your game must have a main character or object, other objects and at least
two scoreboards that keep track of different things that happen in the
game. You may use the Scoreboard class we developed in class or you may
use your own scoreboard.
2. Some objects (this may include the main character) move in directions other
than the direction they’re facing. This is like the paddle in Pong or the
cactus in Balloons.
3. Some objects (this may include the main character) move in the direction
they are facing. This is like the crab and lobster in little-crab or the greep
in Frogger.
4. Things happen when the user presses keyboard keys. So far, we’re had
objects change directions when the user presses arrow keys, but this
requirement is more general than that.
5. One class must have an image that is created with code, such as the paddle
in Pong. This may not include the Scoreboard.
6. One class must have at least 3 possible images and each object’s image must
be randomly selected when the object is created. This is like the balloons in
the Balloons scenario.
7. Something must happen when two objects intersect. In Balloons, each
balloon was removed from the world when it touched the cactus. In Frogger,
the greep’s image changed when it touched a tomato. In several scenarios,
the score changed when two objects intersected.
8. At least one original image must be used. This could be a jpeg image for the
background or a png image for an object.
9. Your game must use at least one of the following animation affects:
a. At least three images in a sequence that animate an object. In littlecrab, the crab’s image alternated between two images to make it look
like the crab’s legs were moving. In this requirement, your object must
use at least three images to create an animation.
b. One character leaves a fading trail as it moves. This is like the smoke
affect in Breakout.
c. Your game uses a scrolling background affect. This is like the cargame scenario where the lines on the road moved to make it appear
that the stationary car was moving.
d. An explosion occurs when something happens in your game. See
information below about this animation affect.
Making explosions:
On the shared drive there is a folder called Greenfoot Resources. In the Helper
classes folder, there is a Java file called Explosion, an image called explosion.png
and a sound file called explosion.wav. Create a new class called Explosion and copy
the code from the explosion.java file into this class. Then copy the explosion.wav
file into the sounds folder of your project and the explosions.png file into the
images folder of your project.
To create the explosion affect, create a new Explosion object and add it to the
world:
getWorld().addObject( new Explosion(), x, y );
Download